﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Xml;
using System.Web;
using System.Web.UI;
using System.Web.Script.Serialization;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Runtime.InteropServices;
using System.IO;
using System.Net;
using System.Threading.Tasks;
using DBBase;
using Newtonsoft.Json.Linq;

namespace Business
{
    public partial class anjianmainform : Form
    {

        public anjianmainform m_mainform;

        public static string sSQLConnect;

        public int ilsh;
        public string ihphm;
        public static string shqjclb;
        public string zjlsh;

        public static string sDataBaseIp;
        public static string sDataBaseName;
        public static string sDataBaseUserName;
        public static string sDataBasePwd;
        public static string sajsc; //安检删除
        public static string ssfsc; //收费删除
        public static string ywlx;



        public anjianmainform()
        {
            InitializeComponent();            
            readxml();
            readxmlZJ();
        }

        public static string CompanyId;//综检测联网id
        public static string username;///登录账号
        public static string password;//登录密码
        public static string StationName;//检测站名称
        public static string urlZJ;//URL
        public static string StationCode;//行政区划代码
        public static string token;
        public static string PictruePath;
        public static string ScanModel;//高拍仪型号
        public bool sjhy_pd;
        public int Keyitem = 0;
        public int Generalitem = 0;
        public string Levelitem="1";
        public int WEIGHTTOTAL;
        public class RootObject
        {
            public string code { get; set; }
            public string status { get; set; }
            public string access_token { get; set; }
            public string data { get; set; }
        }
        public class date
        {
            public string detectSn { get; set; }
        }
        public static string Post_denglu(string Url, string Data, string Referer)
        {
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url);
          
            request.Method = "POST";
            //   request.Referer = Referer;
            byte[] bytes = Encoding.UTF8.GetBytes(Data);
            request.ContentType = "application/json; charset=UTF-8";
            request.ContentLength = bytes.Length;
            Stream myResponseStream = request.GetRequestStream();
            myResponseStream.Write(bytes, 0, bytes.Length);

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
            string retString = myStreamReader.ReadToEnd();

            myStreamReader.Close();
            myResponseStream.Close();

            if (response != null)
            {
                response.Close();
            }
            if (request != null)
            {
                request.Abort();
            }
            return retString;
        }

        public static string Post(string Url, string Data, string Referer,string s_token)
        {
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url);

            request.Method = "POST";
            request.Headers["token"] = s_token;     
           
            //   request.Referer = Referer;
            byte[] bytes = Encoding.UTF8.GetBytes(Data);
            request.ContentType = "application/json; charset=UTF-8";
            request.ContentLength = bytes.Length;
            Stream myResponseStream = request.GetRequestStream();
            myResponseStream.Write(bytes, 0, bytes.Length);

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
            string retString = myStreamReader.ReadToEnd();

            myStreamReader.Close();
            myResponseStream.Close();

            if (response != null)
            {
                response.Close();
            }
            if (request != null)
            {
                request.Abort();
            }
            return retString;
        }

       
        // 获取综检联网信息
        public void readxmlZJ()
        {

            string path = "";
            path = System.Windows.Forms.Application.StartupPath + path + "\\DB.xml";
            string path1 = string.Format(@"{0}", path);

            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(path1);
            XmlNode xn = xmlDoc.SelectSingleNode("DB1");
            XmlNodeList xnl = xn.ChildNodes;
            foreach (XmlNode xnf in xnl)
            {
                XmlElement xe = (XmlElement)xnf;

                CompanyId = xe.GetAttribute("CompanyId");
                username = xe.GetAttribute("username");
                password = xe.GetAttribute("password");
                StationName = xe.GetAttribute("StationName");
                urlZJ = xe.GetAttribute("urlZJ");
                s_url_38900= xe.GetAttribute("urlAJ");
                StationCode = xe.GetAttribute("StationCode");
                PictruePath = xe.GetAttribute("PictruePath");
                ScanModel = xe.GetAttribute("ScanModel");
            }


        }
        public string sToken="";
        public string getToken()
        {
            try
            {
                string vehispara = "";
                string stoubao = "<?xml version=\"1.0\" encoding=\"GBK\"?>";
                vehispara = stoubao + string.Format("<root><vehispara><username>{0}</username><password>{1}</password></vehispara></root>",
                    username,
                    password);

                string surl = urlZJ + "/login ";
                string sjieguo = Post_denglu(surl, vehispara, "");

                  XmlDocument xmlstr = new XmlDocument();
                xmlstr.LoadXml(sjieguo);
                if (xmlstr.SelectSingleNode("/root/code").InnerText == "1")
                {
                    sToken = xmlstr.SelectSingleNode("/root/message").InnerText;
                }

                return sToken;
            }
            catch (Exception)
            {
                MessageBox.Show("身份证验证发生错误");
                return "失败";
            }

        }
       
      
       
        //声明INI文件的写操作函数 WritePrivateProfileString()
        [DllImport("kernel32")]
        private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);

        //声明INI文件的读操作函数 GetPrivateProfileString()
        [DllImport("kernel32")]
        private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
        private string sPath = null;
        //ini文件
        public void Ini(string path)
        {
            this.sPath = path;
        }
        public void Writue(string section, string key, string value)
        {
            // section=配置节，key=键名，value=键值，path=路径
            WritePrivateProfileString(section, key, value, sPath);
        }
        //日志存档
        public void Savelog_erro(string sneirong, string sjylsh)
        {
            string path = "";
            path = System.Windows.Forms.Application.StartupPath + path + "\\日志信息" + "\\" + sjylsh + "\\";
            string path1 = string.Format(@"{0}", path);
            if (!Directory.Exists(path1))
            {
                Directory.CreateDirectory(path1);
            }
            path1 = path1 + "上传报错.ini";
            Ini(path1);
            Writue("日志内容", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), sneirong);

        }

        string ycy = "";
        public void updatpanding(string sjieguo, int m_iDetectID)
        {
            string sSQL;
            sSQL = string.Format(@"Update PD_AJ Set PD_PJ='{0}' where DETECT_ID={1}", sjieguo, m_iDetectID);
            Query mquery = new Query();
            mquery.InsertDB(sSQL);
        }

        private void btn_UploadZJ_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.Format("{0}", ilsh) != "0")
                {
                    sjhy_pd = false;

                    Query mquery = new Query();
                    string sql;
                    sql = string.Format(@"Select DET_LSH,DET_YCY from Detects_SJA where DETECT_ID={0} ", ilsh);

                    DataTable dt = mquery.GetTable(sql);
                    if (dt.Rows.Count > 0)
                    {
                        updatpanding(cbxLevel.Text, ilsh);
                        ycy = dt.Rows[0]["DET_YCY"].ToString().Trim();
                        get_26765数据(dt.Rows[0]["DET_LSH"].ToString().Trim());
                    }
                }

            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message+ex.StackTrace);
            }
        }

        public void get_26765数据(string jylsh)
        {
            Class_DES des = new Class_DES();
            var jyjgbh = "";
            var jcxdh = "1";
            var hpzl = "";
            var hphm = "";
            var clsbdh = "";
            var token = getToken();
            string cwkc = "0";
            string cwkk = "0";
            string cwkg = "0";
            string cllx = "";
            string qzs = "";
            string qdxs = "";
            string zczs = "";
            string zczw = "";
            string fdjh = "";
            string zs = "";
            string bzzw = "";
            string qzdz = "";
            string jcxlb = "";
            string qdfs = "";
            string zws = "";
            string hzzl = "";
            string csys = "";
            string dlyszh = "";
            string ccdjrq = "";
            string jyrq = "";
            string rlzl = "";
            string zxzxjxs = "";
            string syr = "";
            string sjhm = "";
            string dz = "";
            string jyxm = "";
            string jycs = "";
            string zxzsl = "";
            string urlAJ = "";
            string det_id = "";
            // 3.2	开始一个检测流程
            #region
            Query mquery = new Query();
            string sql;
            sql = string.Format(@"SELECT  top 1  * from AUTO,Detects_SJA,Detects_SJB,WJ,StationInfor
                                where AUTO.AT_ID=Detects_SJA.AT_ID 
                                and Detects_SJA.DETECT_ID=Detects_SJB.DETECT_ID
                                and Detects_SJB.DETECT_ID = WJ.DETECT_ID
                                and Detects_SJA.DET_LSH='{0}'order by Detects_SJA.DETECT_ID desc ", jylsh);

            DataTable dt = mquery.GetTable(sql);
            if (dt.Rows.Count > 0)
            {
                jyjgbh = dt.Rows[0]["SI_JCZBH"].ToString().Trim();
                urlAJ = dt.Rows[0]["SI_WEB"].ToString().Trim();
                hpzl = (dt.Rows[0]["AT_HPZL"].ToString().Trim()).Substring(0, 2);
                hphm = dt.Rows[0]["AT_HPHM"].ToString().Trim();
                cllx = dt.Rows[0]["AT_CLLX"].ToString().Trim();
                zs = dt.Rows[0]["AT_ZS"].ToString().Trim();
                syr = dt.Rows[0]["AT_SYR"].ToString().Trim();
                sjhm = dt.Rows[0]["AT_DH"].ToString().Trim();
                dz = dt.Rows[0]["AT_DZ"].ToString().Trim();
                zws = dt.Rows[0]["AT_HDZK"].ToString().Trim();
                hzzl = dt.Rows[0]["AT_HDZZL"].ToString().Trim();
                dlyszh = dt.Rows[0]["AT_DLYSZ"].ToString().Trim();
                csys = GetCsysCode(dt.Rows[0]["AT_CSYS"].ToString().Trim());
                cwkc = dt.Rows[0]["AT_HXCHANG"].ToString().Trim();
                cwkk = dt.Rows[0]["AT_HXKUAN"].ToString().Trim();
                cwkg = dt.Rows[0]["AT_HXGAO"].ToString().Trim();
                ccdjrq = DateTime.Parse(dt.Rows[0]["AT_CCDJRQ"].ToString()).ToString("yyyy-MM-dd");
                jyrq = DateTime.Parse(dt.Rows[0]["DET_DATE"].ToString()).ToString("yyyy-MM-dd");
                rlzl = string.IsNullOrEmpty(dt.Rows[0]["AT_RYZL"].ToString().Trim()) ? "A" : dt.Rows[0]["AT_RYZL"].ToString().Trim().Substring(0, 1);
                zczw = dt.Rows[0]["AT_ZCZW"].ToString().Trim();
                qdfs = dt.Rows[0]["AT_QDFS"].ToString().Trim();
                jyxm = dt.Rows[0]["DET_JYXM"].ToString().Trim();
                jcxdh = dt.Rows[0]["DET_JCXH"].ToString().Trim();
                jycs = dt.Rows[0]["DET_JYCS"].ToString().Trim();
                zxzsl = dt.Rows[0]["AT_SZX"].ToString().Trim().Contains("True") ? "2" : "1";
                det_id = dt.Rows[0]["DETECT_ID"].ToString().Trim();
                if (hpzl.Contains("16"))
                {
                    hphm = hphm + "学";
                }
                clsbdh = dt.Rows[0]["AT_VIN"].ToString().Trim();
                if ((jcxdh + "").Length < 1)
                {
                    jcxdh = "1";
                }

                if (cllx.Substring(0, 1) == "B" || cllx.Substring(0, 1) == "G")
                {
                    qzs = "0";
                    qdxs = "-";
                    zczs = "";
                    zczw = "";
                    fdjh = "";
                    if (zs.Contains("3"))
                    {
                        bzzw = "1,2,3";
                    }
                    if (zs.Contains("2"))
                    {
                        bzzw = "1,2";
                    }
                }
                else
                {
                    if (dt.Rows[0]["AT_SZX"].ToString().Trim().Contains("True"))
                    {
                        qzs = "2";
                    }
                    else
                    {
                        qzs = "1";
                        if (zs.Contains("4"))
                        {
                            bzzw = "3,4";
                        }
                        if (zs.Contains("5"))
                        {
                            bzzw = "3,4,5";
                        }
                    }
                }
                if (dt.Rows[0]["AT_SUTYPE"].ToString().Trim().Contains("非"))
                {
                    zxzxjxs = "1";
                }
                else if (dt.Rows[0]["AT_SUTYPE"].ToString().Trim().Contains("无"))
                {
                    zxzxjxs = "";
                }
                else
                {
                    zxzxjxs = "0";
                }
                if (dt.Rows[0]["AT_LAMP"].ToString().Trim().Contains("二"))
                {
                    qzdz = "03";
                }
                else if (dt.Rows[0]["AT_LAMP"].ToString().Trim().Contains("四"))
                {
                    qzdz = "01";
                }
                else if (dt.Rows[0]["AT_LAMP"].ToString().Trim().Contains("一"))
                {
                    qzdz = "05";
                }
                if (cllx.Substring(0, 1) == "M")
                {
                    jcxlb = "2";// "2";
                    zczs = "";
                }
                else
                {
                    jcxlb = "1";// "1";
                    zczs = zczw.Length.ToString();//驻车轴数
                }

                string vehispara = "";
                vehispara = string.Format(@"<root><vehispara>
                <jylsh>{0}</jylsh>
				<jyjgbh>{1}</jyjgbh>
				<jcxdh>{2}</jcxdh>
				<xh>{3}</xh>
				<hpzl>{4}</hpzl>
				<hphm>{5}</hphm>
				<clsbdh>{6}</clsbdh>
				<fdjh>{7}</fdjh>
				<csys>{8}</csys>
				<syxz>{9}</syxz>
                <ccdjrq>{10}</ccdjrq>
                <jyrq>{11}</jyrq>
                <jyyxqz>{12}</jyyxqz>
                <bxzzrq>{13}</bxzzrq>
                <rlzl>{14}</rlzl>
                <gl>{15}</gl>
                <zs>{16}</zs>
                <zj>{17}</zj>
                <qlj>{18}</qlj>
                <hlj>{19}</hlj>
                <zzl>{20}</zzl>
                <zbzl>{21}</zbzl>
                <ccrq>{22}</ccrq>
                <qdxs>{23}</qdxs>
                <zczs>{24}</zczs>
                <zczw>{25}</zczw>
                <zzs>{26}</zzs>
                <zzly>{27}</zzly>
                <qzdz>{28}</qzdz>
                <zxzxjxs>{29}</zxzxjxs>
                <lcbds>{30}</lcbds>
                <jylb>{31}</jylb>
                <jyxm>{32}</jyxm>
                <bhgx>{33}</bhgx>
                <dlsj>{34}</dlsj>
                <jycs>{35}</jycs>
                <dly>{36}</dly>
                <ycy>{37}</ycy>
                <wjy>{38}</wjy>
                <dtjyy>{39}</dtjyy>
                <dpjyy>{40}</dpjyy>
                <clpp1>{41}</clpp1>
                <clxh>{42}</clxh>
                <syr>{43}</syr>
                <cllx>{44}</cllx>
                <cwkc>{45}</cwkc>
                <cwkk>{46}</cwkk>
                <cwkg>{47}</cwkg>
                <clyt>{48}</clyt>
                <ytsx>{49}</ytsx>
                <dlysfzh>{50}</dlysfzh>
                <ycysfzh>{51}</ycysfzh>
                <wjysfzh>{52}</wjysfzh>
                <dtjyysfzh>{53}</dtjyysfzh>
                <dpjyysfzh>{54}</dpjyysfzh>
                <clsslb>{55}</clsslb>
                <jcxlb>{56}</jcxlb>
                <sjr>{57}</sjr>
                <sjrsfzh>{58}</sjrsfzh>
                <qzs>{59}</qzs>
                <bzzw>{60}</bzzw>
                <dlyszh>{61}</dlyszh>
                <jylbzl>{62}</jylbzl>
                <sfqszxz>{63}</sfqszxz>
                <sfazwb>{64}</sfazwb>
                <wbzl>{65}</wbzl>
                <wbspcd>{66}</wbspcd>
                <zkrs>{67}</zkrs>
                <hdzzl>{68}</hdzzl>
                </vehispara>
                </root>",
            jylsh,
            jyjgbh,
            jcxdh,
            "",
            hpzl,
            hphm,
            clsbdh,
            dt.Rows[0]["AT_FDJH"].ToString().Trim(),
            csys,
            getsqlmessage("table_syxz", dt.Rows[0]["AT_SYXZ"].ToString().Trim()),
            ccdjrq,
            jyrq,//string.IsNullOrEmpty(dt.Rows[0]["djrq"].ToString().Trim()) ? "" : dt.Rows[0]["djrq"].ToString().Trim().Contains("1900-01-01") ? "" : DateTime.Parse(dt.Rows[0]["djrq"].ToString().Trim()).ToString("yyyy-MM-dd"),
            "",//string.IsNullOrEmpty(dt.Rows[0]["yxqz"].ToString().Trim()) ? "" : dt.Rows[0]["yxqz"].ToString().Trim().Contains("1900-01-01") ? "" : DateTime.Parse(dt.Rows[0]["yxqz"].ToString().Trim()).ToString("yyyy-MM-dd"),
            string.IsNullOrEmpty(dt.Rows[0]["AT_保险终止日期"].ToString().Trim()) ? "" : dt.Rows[0]["AT_保险终止日期"].ToString().Trim().Contains("1900-01-01") ? "" : DateTime.Parse(dt.Rows[0]["AT_保险终止日期"].ToString().Trim()).ToString("yyyy-MM-dd"),
            rlzl,
            dt.Rows[0]["AT_GL"].ToString().Trim(),
            dt.Rows[0]["AT_ZS"].ToString().Trim(),
            dt.Rows[0]["AT_ZJ"].ToString().Trim(),
            dt.Rows[0]["AT_QLJ"].ToString().Trim(),
            dt.Rows[0]["AT_HLJ"].ToString().Trim(),
            dt.Rows[0]["AT_ZZL"].ToString().Trim(),
            dt.Rows[0]["AT_ZBZL"].ToString().Trim(),
            string.IsNullOrEmpty(dt.Rows[0]["AT_CCRQ"].ToString().Trim()) ? "" : dt.Rows[0]["AT_CCRQ"].ToString().Trim().Contains("1900-01-01") ? "" : DateTime.Parse(dt.Rows[0]["AT_CCRQ"].ToString().Trim()).ToString("yyyy-MM-dd"),
            getqdxs(qdfs, zs, zczw),
            zczs,
            zczw,
            "",
            "1",
            qzdz,
            zxzxjxs,
            dt.Rows[0]["AT_LCB"].ToString().Trim(),
            dt.Rows[0]["DET_JCLB"].ToString().Trim().Substring(0, 2),
            jyxm,
            "",
            dt.Rows[0]["DET_DATE"].ToString().Trim(),
            jycs,
            dt.Rows[0]["DET_DLY"].ToString().Trim(),
            ycy,
             "",
            "",
             "",
            dt.Rows[0]["AT_CLZWPP"].ToString().Trim(),
            dt.Rows[0]["AT_CLXH"].ToString().Trim(),
            syr,
            getsqlmessage("table_cllx", dt.Rows[0]["AT_CLLX"].ToString().Trim()),
            dt.Rows[0]["AT_CHANG"].ToString().Trim(),
            dt.Rows[0]["AT_KUAN"].ToString().Trim(),
            dt.Rows[0]["AT_GAO"].ToString().Trim(),
            "P1",
            "9",
            get_SfzhID(dt.Rows[0]["DET_DLY"].ToString().Trim()),
            "",
            "",
            "",
           "",
             dt.Rows[0]["AT_SSLB"].ToString().Trim().Substring(0, 2),
            jcxlb,
            "",
            "",
            qzs,
            bzzw,
            dlyszh,
            "",
            dt.Rows[0]["AT_SZX"].ToString().Trim().Contains("True") ? "1" : "2",
            "",
            dt.Rows[0]["AT_WBZL"].ToString().Trim(),
            "",
            zws,
            hzzl);
                string surl = string.Format("{0}/uploaddata", urlZJ);
                string return_message = Post(surl, vehispara, "", token);

                SaveLog(jylsh, "车辆信息", vehispara.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传车辆信息失败");
                    return;
                }
                //XmlDocument xmlstr_1 = new XmlDocument();
                //xmlstr_1.LoadXml(return_message);
                //if (!(xmlstr_1.SelectSingleNode("/root/code").InnerText == "1"))
                //{
                //    MessageBox.Show("发送：" + vehispara + "\r\n接收：" + return_message);

                //}
            }
            #endregion

            //3.3	提交数据
            #region
            var flag = "";//已经上传内容
            if (jyxm.Contains("NQ"))
            {
                #region NQ开始
                StringBuilder vehispara18C55 = new StringBuilder();
                vehispara18C55.AppendFormat("<root><vehispara>");
                vehispara18C55.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C55.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C55.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C55.AppendFormat("<jycs>{0}</jycs>", jycs);
                vehispara18C55.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C55.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C55.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);

                vehispara18C55.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "");
                vehispara18C55.AppendFormat("<jyxm>{0}</jyxm>", "NQ");
                vehispara18C55.AppendFormat("<kssj>{0}</kssj>", getguocheng_time(jylsh, "NQ", "18C55"));
                vehispara18C55.AppendFormat("</vehispara></root>");

                var return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C55.ToString(), "", token);

                SaveLog(jylsh, "NQ开始", vehispara18C55.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传NQ开始失败");
                    return;
                }
                #endregion

                #region NQ过程
                StringBuilder vehispara18C80 = new StringBuilder();
                vehispara18C80.AppendFormat("<root><vehispara>");
                vehispara18C80.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C80.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C80.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C80.AppendFormat("<jycs>{0}</jycs>", jycs);
                vehispara18C80.AppendFormat("<jyxm>{0}</jyxm>", "NQ");
                vehispara18C80.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C80.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C80.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);

                vehispara18C80.AppendFormat("<rlwcx>{0}</rlwcx>", dt.Rows[0]["WJ_lwcx_jl"].ToString().Trim());
                vehispara18C80.AppendFormat("<lwcxjgms>{0}</lwcxjgms>", "");
                vehispara18C80.AppendFormat("<syr>{0}</syr>", syr);
                vehispara18C80.AppendFormat("<sjhm>{0}</sjhm>", sjhm);
                vehispara18C80.AppendFormat("<lxdz>{0}</lxdz>", dz);
                vehispara18C80.AppendFormat("<yzbm>{0}</yzbm>", "");
                vehispara18C80.AppendFormat("</vehispara></root>");

                return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C80.ToString(), "", token);

                SaveLog(jylsh, "NQ过程", vehispara18C80.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传NQ过程失败");
                    return;
                }
                #endregion

                #region NQ结束
                StringBuilder vehispara18C58 = new StringBuilder();
                vehispara18C58.AppendFormat("<root><vehispara>");
                vehispara18C58.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C58.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C58.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C58.AppendFormat("<jycs>{0}</jycs>", jycs);
                vehispara18C58.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C58.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C58.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);

                vehispara18C58.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "");
                vehispara18C58.AppendFormat("<jyxm>{0}</jyxm>", "NQ");
                vehispara18C58.AppendFormat("<jssj>{0}</jssj>", getguocheng_time(jylsh, "NQ", "18C58"));
                vehispara18C58.AppendFormat("</vehispara></root>");

                return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C58.ToString(), "", token);

                SaveLog(jylsh, "NQ结束", vehispara18C58.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传NQ结束失败");
                    return;
                }
                #endregion

            }
            if (jyxm.Contains("UC"))
            {
                #region UC开始
                StringBuilder vehispara18C55 = new StringBuilder();
                vehispara18C55.AppendFormat("<root><vehispara>");
                vehispara18C55.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C55.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C55.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C55.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_WJCS"].ToString().Trim());
                vehispara18C55.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C55.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C55.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);

                vehispara18C55.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "");
                vehispara18C55.AppendFormat("<jyxm>{0}</jyxm>", "UC");
                vehispara18C55.AppendFormat("<kssj>{0}</kssj>", getguocheng_time(jylsh, "UC", "18C55"));
                vehispara18C55.AppendFormat("</vehispara></root>");

                var return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C55.ToString(), "", token);

                SaveLog(jylsh, "UC开始", vehispara18C55.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传UC开始失败");
                    return;
                }
                #endregion

                #region UC过程
                StringBuilder vehispara18C80 = new StringBuilder();
                vehispara18C80.AppendFormat("<root><vehispara>");
                vehispara18C80.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C80.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C80.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C80.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_WJCS"].ToString().Trim());
                vehispara18C80.AppendFormat("<jyxm>{0}</jyxm>", "UC");
                vehispara18C80.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C80.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C80.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);
                vehispara18C80.AppendFormat("<rhplx>{0}</rhplx>", dt.Rows[0]["WJ_wyx_hphm"].ToString().Trim());
                vehispara18C80.AppendFormat("<rppxh>{0}</rppxh>", dt.Rows[0]["WJ_wyx_clpp"].ToString().Trim());
                vehispara18C80.AppendFormat("<rvin>{0}</rvin>", dt.Rows[0]["WJ_wyx_cjh"].ToString().Trim());
                vehispara18C80.AppendFormat("<rfdjh>{0}</rfdjh>", dt.Rows[0]["WJ_wyx_fdjh"].ToString().Trim());
                vehispara18C80.AppendFormat("<rcsys>{0}</rcsys>", dt.Rows[0]["WJ_wyx_csys"].ToString().Trim());
                vehispara18C80.AppendFormat("<bgfdjxh>{0}</bgfdjxh>", dt.Rows[0]["AT_XFDJH"].ToString().Trim());
                vehispara18C80.AppendFormat("<bgfdjh>{0}</bgfdjh>", dt.Rows[0]["AT_XFDJXH"].ToString().Trim());
                vehispara18C80.AppendFormat("<jyyjy>{0}</jyyjy>", ""); 
                vehispara18C80.AppendFormat("<wgjcjyy>{0}</wgjcjyy>", dt.Rows[0]["DET_WJCZY"].ToString().Trim());
                vehispara18C80.AppendFormat("<wgjcjyysfzh>{0}</wgjcjyysfzh>", get_SfzhID(dt.Rows[0]["DET_WJCZY"].ToString().Trim()));
                vehispara18C80.AppendFormat("<bz>{0}</bz>", "");
                vehispara18C80.AppendFormat("</vehispara></root>");

  
                return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C80.ToString(), "", token);

                SaveLog(jylsh, "UC过程", vehispara18C80.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传UC过程失败");
                    return;
                }
                #endregion

                #region UC结束
                StringBuilder vehispara18C58 = new StringBuilder();
                vehispara18C58.AppendFormat("<root><vehispara>");
                vehispara18C58.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C58.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C58.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C58.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_WJCS"].ToString().Trim());
                vehispara18C58.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C58.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C58.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);

                vehispara18C58.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "");
                vehispara18C58.AppendFormat("<jyxm>{0}</jyxm>", "UC");
                vehispara18C58.AppendFormat("<jssj>{0}</jssj>", getguocheng_time(jylsh, "UC", "18C58"));
                vehispara18C58.AppendFormat("</vehispara></root>");

                return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C58.ToString(), "", token);

                SaveLog(jylsh, "UC结束", vehispara18C58.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传UC结束失败");
                    return;
                }
                #endregion

            }
            if (jyxm.Contains("F1"))
            {
                #region F1开始
                StringBuilder vehispara18C55 = new StringBuilder();
                vehispara18C55.AppendFormat("<root><vehispara>");
                vehispara18C55.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C55.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C55.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C55.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_WJCS"].ToString().Trim());
                vehispara18C55.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C55.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C55.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);

                vehispara18C55.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "");
                vehispara18C55.AppendFormat("<jyxm>{0}</jyxm>", "F1");
                vehispara18C55.AppendFormat("<kssj>{0}</kssj>", getguocheng_time(jylsh, "F1", "18C55"));
                vehispara18C55.AppendFormat("</vehispara></root>");

                var return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C55.ToString(), "", token);

                SaveLog(jylsh, "F1开始", vehispara18C55.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传F1开始失败");
                    return;
                }
                #endregion

                bool isGC = false;

                string sfqssq = dt.Rows[0]["AT_QDFS"].ToString().Trim().Contains("四驱") ? "1" : "0";//是否全时四驱
                string sfdzzc = dt.Rows[0]["AT_DZSS"].ToString().Trim().Contains("True") ? "1" : "0";
                string sfkqxj = (dt.Rows[0]["AT_KQXJZ"].ToString().Trim().Contains("无") || dt.Rows[0]["AT_KQXJZ"].ToString().Trim().Length < 1) ? "0" : "1";
                string kqxjz = dt.Rows[0]["AT_KQXJZ"].ToString().Trim();
                string cxlbgd = dt.Rows[0]["WJ_cxlbg_dc"].ToString().Trim();
                string dczxlhwsd = dt.Rows[0]["WJ_hwsd_dczxl"].ToString().Trim();
                string dcqtlhwsd = dt.Rows[0]["WJ_hwsd_dcqtl"].ToString().Trim();
                string gchwsd = dt.Rows[0]["WJ_hwsd_gc"].ToString().Trim();
                string yzzgd = dt.Rows[0]["WJ_bwgdc_dcqz"].ToString().Trim();
                string yzygd = dt.Rows[0]["WJ_bwgdc_dcqy"].ToString().Trim();
                string yzzygdc = dt.Rows[0]["WJ_bwgdc_dcqgdc"].ToString().Trim();
                string zhzzgd = dt.Rows[0]["WJ_bwgdc_dchz"].ToString().Trim();
                string zhzygd = dt.Rows[0]["WJ_bwgdc_dchy"].ToString().Trim();
                string zhzzygdc = dt.Rows[0]["WJ_bwgdc_dchgdc"].ToString().Trim();
                string cxlb = dt.Rows[0]["WJ_cxlbg_dc"].ToString().Trim();
                string wkcc = dt.Rows[0]["WJ_qtcs_wkcc"].ToString().Trim();
                string zj = dt.Rows[0]["WJ_qtcs_zj"].ToString().Trim();
                string bz = dt.Rows[0]["WJ_bz"].ToString().Trim();
                if (dt.Rows[0]["AT_HPZL"].ToString().Trim().Contains("挂") || cllx.Substring(0, 1) == "B" || cllx.Substring(0, 1) == "G")
                {
                    zxzsl = "0";
                    isGC = true;
                }
                if (isGC)
                {
                    cxlbgd = dt.Rows[0]["WJ_cxlbg_gc"].ToString().Trim();
                    yzzgd = "";
                    yzygd = "";
                    yzzygdc = "";
                    zhzzgd = dt.Rows[0]["WJ_bwgdc_gcz"].ToString().Trim();
                    zhzygd = dt.Rows[0]["WJ_bwgdc_gcy"].ToString().Trim();
                    zhzzygdc = dt.Rows[0]["WJ_bwgdc_gcgdc"].ToString().Trim();
                    cxlb = dt.Rows[0]["WJ_cxlbg_gc"].ToString().Trim();
                }

                #region F1过程
                StringBuilder vehispara18C80 = new StringBuilder();
                vehispara18C80.AppendFormat("<root><vehispara>");
                vehispara18C80.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C80.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C80.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C80.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_WJCS"].ToString().Trim());
                vehispara18C80.AppendFormat("<jyxm>{0}</jyxm>", "F1");
                vehispara18C80.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C80.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C80.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);
                vehispara18C80.AppendFormat("<rwkcc>{0}</rwkcc>", wkcc == "" ? 0 : 1);
                vehispara18C80.AppendFormat("<rzj>{0}</rzj>", dt.Rows[0]["WJ_tzcs_zj"].ToString().Trim());
                vehispara18C80.AppendFormat("<rhdzrs>{0}</rhdzrs>", dt.Rows[0]["WJ_tzcs_hzrs"].ToString().Trim());
                vehispara18C80.AppendFormat("<rlbgd>{0}</rlbgd>", dt.Rows[0]["WJ_tzcs_lbgd"].ToString().Trim());
                vehispara18C80.AppendFormat("<rhzgbthps>{0}</rhzgbthps>", dt.Rows[0]["WJ_tzcs_xj"].ToString().Trim());
                vehispara18C80.AppendFormat("<rkcyjck>{0}</rkcyjck>", dt.Rows[0]["WJ_tzcs_kcck"].ToString().Trim());
                vehispara18C80.AppendFormat("<rkccktd>{0}</rkccktd>", dt.Rows[0]["WJ_tzcs_kcyd"].ToString().Trim());
                vehispara18C80.AppendFormat("<rhx>{0}</rhx>", dt.Rows[0]["WJ_tzcs_hx"].ToString().Trim());
                vehispara18C80.AppendFormat("<rcswg>{0}</rcswg>", dt.Rows[0]["WJ_wgjc_wg"].ToString().Trim());
                vehispara18C80.AppendFormat("<rwgbs>{0}</rwgbs>", dt.Rows[0]["WJ_wgjc_wgbs"].ToString().Trim());
                vehispara18C80.AppendFormat("<rwbzm>{0}</rwbzm>", dt.Rows[0]["WJ_wgjc_wbzm"].ToString().Trim());
                vehispara18C80.AppendFormat("<rlt>{0}</rlt>", dt.Rows[0]["WJ_wgjc_lt"].ToString().Trim());
                vehispara18C80.AppendFormat("<rhpaz>{0}</rhpaz>", dt.Rows[0]["WJ_wgjc_hp"].ToString().Trim());
                vehispara18C80.AppendFormat("<rjzgj>{0}</rjzgj>", dt.Rows[0]["WJ_wgjc_jz"].ToString().Trim());
                vehispara18C80.AppendFormat("<rqcaqd>{0}</rqcaqd>", dt.Rows[0]["WJ_aqzz_aqd"].ToString().Trim());
                vehispara18C80.AppendFormat("<rsjp>{0}</rsjp>", dt.Rows[0]["WJ_aqzz_yjfj"].ToString().Trim());
                vehispara18C80.AppendFormat("<rmhq>{0}</rmhq>", dt.Rows[0]["WJ_aqzz_mhq"].ToString().Trim());
                vehispara18C80.AppendFormat("<rxsjly>{0}</rxsjly>", dt.Rows[0]["WJ_aqzz_xsjlzz"].ToString().Trim());
                vehispara18C80.AppendFormat("<rcsfgbs>{0}</rcsfgbs>", dt.Rows[0]["WJ_aqzz_fgbs"].ToString().Trim());
                vehispara18C80.AppendFormat("<rclwbzb>{0}</rclwbzb>", dt.Rows[0]["WJ_aqzz_wbbz"].ToString().Trim());
                vehispara18C80.AppendFormat("<rchfh>{0}</rchfh>", dt.Rows[0]["WJ_aqzz_fh"].ToString().Trim());
                vehispara18C80.AppendFormat("<ryjc>{0}</ryjc>", dt.Rows[0]["WJ_aqzz_yjc"].ToString().Trim());
                vehispara18C80.AppendFormat("<rjjx>{0}</rjjx>", dt.Rows[0]["WJ_aqzz_jjx"].ToString().Trim());
                vehispara18C80.AppendFormat("<rxsgn>{0}</rxsgn>", dt.Rows[0]["WJ_aqzz_xszz"].ToString().Trim());
                vehispara18C80.AppendFormat("<rfbs>{0}</rfbs>", dt.Rows[0]["WJ_aqzz_fbzz"].ToString().Trim());
                vehispara18C80.AppendFormat("<rfzzd>{0}</rfzzd>", dt.Rows[0]["WJ_aqzz_fzzz"].ToString().Trim());
                vehispara18C80.AppendFormat("<rpszdq>{0}</rpszdq>", dt.Rows[0]["WJ_aqzz_pszd"].ToString().Trim());
                vehispara18C80.AppendFormat("<rjxtz>{0}</rjxtz>", dt.Rows[0]["WJ_aqzz_jxzz"].ToString().Trim());
                vehispara18C80.AppendFormat("<rjjqd>{0}</rjjqd>", dt.Rows[0]["WJ_aqzz_qdzz"].ToString().Trim());
                vehispara18C80.AppendFormat("<rfdjcmh>{0}</rfdjcmh>", dt.Rows[0]["WJ_aqzz_jcmhzz"].ToString().Trim());
                vehispara18C80.AppendFormat("<rsddd>{0}</rsddd>", dt.Rows[0]["WJ_aqzz_ddkg"].ToString().Trim());
                vehispara18C80.AppendFormat("<rfzdtb>{0}</rfzdtb>", dt.Rows[0]["WJ_aqzz_fzdtb"].ToString().Trim());
                vehispara18C80.AppendFormat("<rxcbz>{0}</rxcbz>", dt.Rows[0]["WJ_aqzz_xcbzp"].ToString().Trim());
                vehispara18C80.AppendFormat("<rwxhwbz>{0}</rwxhwbz>", dt.Rows[0]["WJ_aqzz_whcbz"].ToString().Trim());
                vehispara18C80.AppendFormat("<rjsqglss>{0}</rjsqglss>", dt.Rows[0]["WJ_aqzz_glss"].ToString().Trim());
                vehispara18C80.AppendFormat("<ztcjrfzzz>{0}</ztcjrfzzz>", dt.Rows[0]["WJ_aqzz_cjrfz"].ToString().Trim());
                vehispara18C80.AppendFormat("<cwkc>{0}</cwkc>", string.IsNullOrWhiteSpace(wkcc)?"": wkcc.Split('×')[0]);
                vehispara18C80.AppendFormat("<cwkk>{0}</cwkk>", string.IsNullOrWhiteSpace(wkcc) ? "" : wkcc.Split('×')[1]);
                vehispara18C80.AppendFormat("<cwkg>{0}</cwkg>", string.IsNullOrWhiteSpace(wkcc) ? "" : wkcc.Split('×')[2]);
                vehispara18C80.AppendFormat("<zj>{0}</zj>", zj == "0" ? "" : zj);
                vehispara18C80.AppendFormat("<cxlbgd>{0}</cxlbgd>", cxlbgd == "0" ? "" : cxlbgd);
                vehispara18C80.AppendFormat("<dczxlhwsd>{0}</dczxlhwsd>", dczxlhwsd);
                vehispara18C80.AppendFormat("<dcqtlhwsd>{0}</dcqtlhwsd>", dcqtlhwsd);
                vehispara18C80.AppendFormat("<gchwsd>{0}</gchwsd>", gchwsd);
                vehispara18C80.AppendFormat("<yzzgd>{0}</yzzgd>", yzzgd == "0" ? "" : yzzgd);
                vehispara18C80.AppendFormat("<yzygd>{0}</yzygd>", yzygd == "0" ? "" : yzygd);
                vehispara18C80.AppendFormat("<yzzygdc>{0}</yzzygdc>", yzzgd == "0" ? "" : yzzygdc);
                vehispara18C80.AppendFormat("<zhzzgd>{0}</zhzzgd>", zhzzgd == "0" ? "" : zhzzgd);
                vehispara18C80.AppendFormat("<zhzygd>{0}</zhzygd>", zhzygd == "0" ? "" : zhzygd);
                vehispara18C80.AppendFormat("<zhzzygdc>{0}</zhzzygdc>", yzzgd == "0" ? "" : zhzzygdc);
                vehispara18C80.AppendFormat("<sfqssq>{0}</sfqssq>", sfqssq);
                vehispara18C80.AppendFormat("<sfdzzc>{0}</sfdzzc>", sfdzzc);
                vehispara18C80.AppendFormat("<sfkqxj>{0}</sfkqxj>", sfkqxj);
                vehispara18C80.AppendFormat("<kqxjz>{0}</kqxjz>", kqxjz);
                vehispara18C80.AppendFormat("<zxzsl>{0}</zxzsl>", zxzsl);
                vehispara18C80.AppendFormat("<jyyjy>{0}</jyyjy>", "");
                vehispara18C80.AppendFormat("<wgjcjyy>{0}</wgjcjyy>", dt.Rows[0]["DET_WJCZY"].ToString().Trim());
                vehispara18C80.AppendFormat("<wgjcjyysfzh>{0}</wgjcjyysfzh>", get_SfzhID(dt.Rows[0]["DET_WJCZY"].ToString().Trim()));
                vehispara18C80.AppendFormat("<bz>{0}</bz>", "");
                vehispara18C80.AppendFormat("<wgbhgyy>{0}</wgbhgyy>","");
                vehispara18C80.AppendFormat("</vehispara></root>");


                return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C80.ToString(), "", token);

                SaveLog(jylsh, "F1过程", vehispara18C80.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传F1过程失败");
                    return;
                }
                #endregion

                #region F1结束
                StringBuilder vehispara18C58 = new StringBuilder();
                vehispara18C58.AppendFormat("<root><vehispara>");
                vehispara18C58.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C58.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C58.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C58.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_WJCS"].ToString().Trim());
                vehispara18C58.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C58.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C58.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);

                vehispara18C58.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "");
                vehispara18C58.AppendFormat("<jyxm>{0}</jyxm>", "F1");
                vehispara18C58.AppendFormat("<jssj>{0}</jssj>", getguocheng_time(jylsh, "F1", "18C58"));
                vehispara18C58.AppendFormat("</vehispara></root>");

                return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C58.ToString(), "", token);

                SaveLog(jylsh, "F1结束", vehispara18C58.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传F1结束失败");
                    return;
                }
                #endregion

            }
            if (jyxm.Contains("DC"))
            {
                #region DC开始
                StringBuilder vehispara18C55 = new StringBuilder();
                vehispara18C55.AppendFormat("<root><vehispara>");
                vehispara18C55.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C55.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C55.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C55.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_DYNACS"].ToString().Trim());
                vehispara18C55.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C55.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C55.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);

                vehispara18C55.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "");
                vehispara18C55.AppendFormat("<jyxm>{0}</jyxm>", "DC");
                vehispara18C55.AppendFormat("<kssj>{0}</kssj>", getguocheng_time(jylsh, "DC", "18C55"));
                vehispara18C55.AppendFormat("</vehispara></root>");

                var return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C55.ToString(), "", token);

                SaveLog(jylsh, "DC开始", vehispara18C55.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传DC开始失败");
                    return;
                }
                #endregion

                #region DC过程
                StringBuilder vehispara18C80 = new StringBuilder();
                vehispara18C80.AppendFormat("<root><vehispara>");
                vehispara18C80.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C80.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C80.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C80.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_DYNACS"].ToString().Trim());
                vehispara18C80.AppendFormat("<jyxm>{0}</jyxm>", "DC");
                vehispara18C80.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C80.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C80.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);
                vehispara18C80.AppendFormat("<rzxx>{0}</rzxx>", dt.Rows[0]["WJ_dpdt_zx"].ToString().Trim());
                vehispara18C80.AppendFormat("<rcdx>{0}</rcdx>", dt.Rows[0]["WJ_dpdt_cd"].ToString().Trim());
                vehispara18C80.AppendFormat("<rzdx>{0}</rzdx>", dt.Rows[0]["WJ_dpdt_zd"].ToString().Trim());
                vehispara18C80.AppendFormat("<rybzsq>{0}</rybzsq>", dt.Rows[0]["WJ_dpdt_yq"].ToString().Trim());
                vehispara18C80.AppendFormat("<fxpzdzyzdl>{0}</fxpzdzyzdl>", dt.Rows[0]["WJ_fxpzdl"].ToString().Trim());
                vehispara18C80.AppendFormat("<jyyjy>{0}</jyyjy>", "");
                vehispara18C80.AppendFormat("<dpdtjyy>{0}</dpdtjyy>", dt.Rows[0]["DET_DTCZY"].ToString().Trim());
                vehispara18C80.AppendFormat("<dpdtjyysfzh>{0}</dpdtjyysfzh>", get_SfzhID(dt.Rows[0]["DET_DTCZY"].ToString().Trim()));
                vehispara18C80.AppendFormat("<ycy>{0}</ycy>", encode(dt.Rows[0]["DET_DTYCY"].ToString().Trim()));
                vehispara18C80.AppendFormat("<ycysfzh>{0}</ycysfzh>", get_SfzhID(dt.Rows[0]["DET_DTYCY"].ToString().Trim()));
                vehispara18C80.AppendFormat("<bz>{0}</bz>", "");
                vehispara18C80.AppendFormat("</vehispara></root>");

                return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C80.ToString(), "", token);

                SaveLog(jylsh, "DC过程", vehispara18C80.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传DC过程失败");
                    return;
                }
                #endregion

                #region DC结束
                StringBuilder vehispara18C58 = new StringBuilder();
                vehispara18C58.AppendFormat("<root><vehispara>");
                vehispara18C58.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C58.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C58.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C58.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_DYNACS"].ToString().Trim());
                vehispara18C58.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C58.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C58.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);

                vehispara18C58.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "");
                vehispara18C58.AppendFormat("<jyxm>{0}</jyxm>", "DC");
                vehispara18C58.AppendFormat("<jssj>{0}</jssj>", getguocheng_time(jylsh, "DC", "18C58"));
                vehispara18C58.AppendFormat("</vehispara></root>");

                return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C58.ToString(), "", token);

                SaveLog(jylsh , "DC结束",  vehispara18C58.ToString());               
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传DC结束失败");
                    return;
                }
                #endregion

            }
            if (jyxm.Contains("C1"))
            {
                #region C1开始
                StringBuilder vehispara18C55 = new StringBuilder();
                vehispara18C55.AppendFormat("<root><vehispara>");
                vehispara18C55.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C55.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C55.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C55.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_DCCS"].ToString().Trim());
                vehispara18C55.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C55.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C55.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);

                vehispara18C55.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "");
                vehispara18C55.AppendFormat("<jyxm>{0}</jyxm>", "C1");
                                           vehispara18C55.AppendFormat("<kssj>{0}</kssj>", getguocheng_time(jylsh, "C1", "18C55"));
                vehispara18C55.AppendFormat("</vehispara></root>");

                var return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C55.ToString(), "", token);

                SaveLog(jylsh , "C1开始",  vehispara18C55.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传C1开始失败");
                    return;
                }
                #endregion

                #region C1过程
                StringBuilder vehispara18C80 = new StringBuilder();
                vehispara18C80.AppendFormat("<root><vehispara>");
                vehispara18C80.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C80.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C80.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C80.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_DCCS"].ToString().Trim());
                vehispara18C80.AppendFormat("<jyxm>{0}</jyxm>", "C1");
                vehispara18C80.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C80.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C80.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);
                vehispara18C80.AppendFormat("<rzxxbj>{0}</rzxxbj>", dt.Rows[0]["WJ_dpbj_zx"].ToString().Trim());
                vehispara18C80.AppendFormat("<rcdxbj>{0}</rcdxbj>", dt.Rows[0]["WJ_dpbj_cd"].ToString().Trim());
                vehispara18C80.AppendFormat("<rxsxbj>{0}</rxsxbj>", dt.Rows[0]["WJ_dpbj_xs"].ToString().Trim());
                vehispara18C80.AppendFormat("<rzdxbj>{0}</rzdxbj>", dt.Rows[0]["WJ_dpbj_zd"].ToString().Trim());
                vehispara18C80.AppendFormat("<rqtbj>{0}</rqtbj>", dt.Rows[0]["WJ_dpbj_qt"].ToString().Trim());
                vehispara18C80.AppendFormat("<jyyjy>{0}</jyyjy>", "");
                vehispara18C80.AppendFormat("<dpjcjyy>{0}</dpjcjyy>", dt.Rows[0]["DET_DPCZY"].ToString().Trim());
                vehispara18C80.AppendFormat("<dpjyysfzh>{0}</dpjyysfzh>", get_SfzhID(dt.Rows[0]["DET_DPCZY"].ToString().Trim()));
                vehispara18C80.AppendFormat("<ycy>{0}</ycy>", dt.Rows[0]["DET_DPYCY"].ToString().Trim());
                vehispara18C80.AppendFormat("<ycysfzh>{0}</ycysfzh>", get_SfzhID(dt.Rows[0]["DET_DPYCY"].ToString().Trim()));
                vehispara18C80.AppendFormat("<ycyjy>{0}</ycyjy>", "");
                vehispara18C80.AppendFormat("<bz>{0}</bz>", "");
                vehispara18C80.AppendFormat("</vehispara></root>");

                return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C80.ToString(), "", token);

                SaveLog(jylsh , "C1过程", vehispara18C80.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传C1过程失败");
                    return;
                }
                #endregion

                #region C1结束
                StringBuilder vehispara18C58 = new StringBuilder();
                vehispara18C58.AppendFormat("<root><vehispara>");
                vehispara18C58.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C58.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C58.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C58.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_DCCS"].ToString().Trim());
                vehispara18C58.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C58.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C58.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);

                vehispara18C58.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "");
                vehispara18C58.AppendFormat("<jyxm>{0}</jyxm>", "C1");
                vehispara18C58.AppendFormat("<jssj>{0}</jssj>", getguocheng_time(jylsh, "C1", "18C58"));
                vehispara18C58.AppendFormat("</vehispara></root>");

                return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C58.ToString(), "", token);

                SaveLog(jylsh , "C1结束",  vehispara18C58.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传C1结束失败");
                    return;
                }
                #endregion
            }         
            if (jyxm.Contains("H1"))
            {
                #region H1开始
                StringBuilder vehispara18C55 = new StringBuilder();
                vehispara18C55.AppendFormat("<root><vehispara>");
                vehispara18C55.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C55.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C55.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C55.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_ZWDCS"].ToString().Trim());
                vehispara18C55.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C55.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C55.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);

                vehispara18C55.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "1");
                vehispara18C55.AppendFormat("<jyxm>{0}</jyxm>", "H1");
                vehispara18C55.AppendFormat("<kssj>{0}</kssj>", getguocheng_time(jylsh, "H1", "18C55"));
                vehispara18C55.AppendFormat("</vehispara></root>");

                var return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C55.ToString(), "", token);

                SaveLog(jylsh , "H1开始",  vehispara18C55.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传H1开始失败");
                    return;
                }
                #endregion

                #region H1过程
                StringBuilder vehispara18C81 = new StringBuilder();
                vehispara18C81.AppendFormat("<root><vehispara>");
                vehispara18C81.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C81.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C81.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C81.AppendFormat("<jyxm>{0}</jyxm>", "H1");
                vehispara18C81.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_ZWDCS"].ToString().Trim());
                vehispara18C81.AppendFormat("<zwygqd>{0}</zwygqd>", des.DeDES(dt.Rows[0]["DET_ZWDGQ"].ToString().Trim()));
                vehispara18C81.AppendFormat("<zwdpd>{0}</zwdpd>", dt.Rows[0]["DET_ZWDJL"].ToString().Trim());
                vehispara18C81.AppendFormat("</vehispara></root>");

                return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C81.ToString(), "", token);

                SaveLog(jylsh , "H1过程",  vehispara18C81.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传H1过程失败");
                    return;
                }
                #endregion

                #region H1结束
                StringBuilder vehispara18C58 = new StringBuilder();
                vehispara18C58.AppendFormat("<root><vehispara>");
                vehispara18C58.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C58.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C58.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C58.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_ZWDCS"].ToString().Trim());
                vehispara18C58.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C58.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C58.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);

                vehispara18C58.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "1");
                vehispara18C58.AppendFormat("<jyxm>{0}</jyxm>", "H1");
                vehispara18C58.AppendFormat("<jssj>{0}</jssj>", getguocheng_time(jylsh, "H1", "18C58"));
                vehispara18C58.AppendFormat("</vehispara></root>");

                return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C58.ToString(), "", token);

                SaveLog(jylsh , "H1结束",  vehispara18C58.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传H1结束失败");
                    return;
                }
                #endregion
            }
            if (jyxm.Contains("H4"))
            {
                #region H4开始
                StringBuilder vehispara18C55 = new StringBuilder();
                vehispara18C55.AppendFormat("<root><vehispara>");
                vehispara18C55.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C55.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C55.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C55.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_YWDCS"].ToString().Trim());
                vehispara18C55.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C55.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C55.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);

                vehispara18C55.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "1");
                vehispara18C55.AppendFormat("<jyxm>{0}</jyxm>", "H4");
                vehispara18C55.AppendFormat("<kssj>{0}</kssj>", getguocheng_time(jylsh, "H4", "18C55"));
                vehispara18C55.AppendFormat("</vehispara></root>");

                var return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C55.ToString(), "", token);

                SaveLog(jylsh , "H4开始",  vehispara18C55.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传H4开始失败");
                    return;
                }
                #endregion

                #region H4过程
                StringBuilder vehispara18C81 = new StringBuilder();
                vehispara18C81.AppendFormat("<root><vehispara>");
                vehispara18C81.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C81.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C81.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C81.AppendFormat("<jyxm>{0}</jyxm>", "H4");
                vehispara18C81.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_YWDCS"].ToString().Trim());
                vehispara18C81.AppendFormat("<ywygqd>{0}</ywygqd>", des.DeDES(dt.Rows[0]["DET_YWDGQ"].ToString().Trim()));
                vehispara18C81.AppendFormat("<ywdpd>{0}</ywdpd>", dt.Rows[0]["DET_YWDJL"].ToString().Trim());
                vehispara18C81.AppendFormat("</vehispara></root>");

                return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C81.ToString(), "", token);

                SaveLog(jylsh , "H4过程",  vehispara18C81.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传H4过程失败");
                    return;
                }
                #endregion

                #region H4结束
                StringBuilder vehispara18C58 = new StringBuilder();
                vehispara18C58.AppendFormat("<root><vehispara>");
                vehispara18C58.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C58.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C58.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C58.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_YWDCS"].ToString().Trim());
                vehispara18C58.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C58.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C58.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);

                vehispara18C58.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "1");
                vehispara18C58.AppendFormat("<jyxm>{0}</jyxm>", "H4");
                vehispara18C58.AppendFormat("<jssj>{0}</jssj>", getguocheng_time(jylsh, "H4", "18C58"));
                vehispara18C58.AppendFormat("</vehispara></root>");

                return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C58.ToString(), "", token);

                SaveLog(jylsh , "H4结束",  vehispara18C58.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传H4结束失败");
                    return;
                }
                #endregion
            }
            if (jyxm.Contains("A1"))
            {
                #region A1开始
                StringBuilder vehispara18C55 = new StringBuilder();
                vehispara18C55.AppendFormat("<root><vehispara>");
                vehispara18C55.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C55.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C55.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C55.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_SLIPCS"].ToString().Trim());
                vehispara18C55.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C55.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C55.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);

                vehispara18C55.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "1");
                vehispara18C55.AppendFormat("<jyxm>{0}</jyxm>", "A1");
                vehispara18C55.AppendFormat("<kssj>{0}</kssj>", getguocheng_time(jylsh, "A1", "18C55"));
                vehispara18C55.AppendFormat("</vehispara></root>");

                var return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C55.ToString(), "", token);

                SaveLog(jylsh , "A1开始",  vehispara18C55.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传A1开始失败");
                    return;
                }
                #endregion

                #region A1过程
                StringBuilder vehispara18C81 = new StringBuilder();
                vehispara18C81.AppendFormat("<root><vehispara>");
                vehispara18C81.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C81.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C81.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C81.AppendFormat("<jyxm>{0}</jyxm>", "A1");
                vehispara18C81.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_SLIPCS"].ToString().Trim());
                vehispara18C81.AppendFormat("<chz>{0}</chz>", des.DeDES(dt.Rows[0]["DET_SLIP"].ToString().Trim()));
                vehispara18C81.AppendFormat("<chpd>{0}</chpd>", dt.Rows[0]["DET_SLIPJL"].ToString().Trim());
                vehispara18C81.AppendFormat("<chz2>{0}</chz2>", zxzsl.Contains("2") ? des.DeDES(dt.Rows[0]["DET_SLIP2"].ToString().Trim()) : "");
                vehispara18C81.AppendFormat("<chpd2>{0}</chpd2>", zxzsl.Contains("2") ? dt.Rows[0]["DET_SLIPJL2"].ToString().Trim() : "");
                vehispara18C81.AppendFormat("</vehispara></root>");

                return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C81.ToString(), "", token);

                SaveLog(jylsh , "A1过程",  vehispara18C81.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传A1过程失败");
                    return;
                }
                #endregion

                #region A1结束
                StringBuilder vehispara18C58 = new StringBuilder();
                vehispara18C58.AppendFormat("<root><vehispara>");
                vehispara18C58.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C58.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C58.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C58.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_SLIPCS"].ToString().Trim());
                vehispara18C58.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C58.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C58.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);
                vehispara18C58.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "1");
                vehispara18C58.AppendFormat("<jyxm>{0}</jyxm>", "A1");
                vehispara18C58.AppendFormat("<jssj>{0}</jssj>", getguocheng_time(jylsh, "A1", "18C58"));
                vehispara18C58.AppendFormat("</vehispara></root>");

                return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C58.ToString(), "", token);

                SaveLog(jylsh , "A1结束",  vehispara18C58.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传A1结束失败");
                    return;
                }
                #endregion
            }
            if (jyxm.Contains("B"))
            {
                string[] zlz = { "yzzlz", "ezzlz", "sanzzlz", "sizzlz", "wzzlz" };//一轴左静态轮荷
                string[] ylz = { "yzylz", "ezylz", "sanzylz", "sizylz", "wzylz" };//一轴右静态轮荷
                string[] kzzh = { "yzkzzh", "ezkzzh", "sanzkzzh", "sizkzzh", "wzkzzh" };//一轴空载轴荷
                string[] qhzzdl = { "yzqhzzdl", "ezqhzzdl", "sanzqhzzdl", "sizqhzzdl", "wzqhzzdl" };//一轴最大左行车制动力值
                string[] qhyzdl = { "yzqhyzdl", "ezqhyzdl", "sanzqhyzdl", "sizqhyzdl", "wzqhyzdl" };//一轴最大右行车制动力值
                string[] qczzdl = { "yzqczzdl", "ezqczzdl", "sanzqczzdl", "sizqczzdl", "wzqczzdl" };//一轴最大左制动力差值
                string[] qcyzdl = { "yqqcyzdl", "ezqcyzdl", "sanzqcyzdl", "sizqcyzdl", "wzqcyzdl" };//最大右制动力差值
                string[] dll = { "yzdll", "ezdll", "sanzdll", "sizdll", "wzdll" };//行车制动率
                string[] zdlpd = { "yzzdlpd", "ezzdlpd", "sanzzdlpd", "sizzdlpd", "wzzdlpd" };//行车制动率判定
                string[] bphl = { "yzbphl", "ezbphl", "sanzbphl", "sizbphl", "wzbphl" };//不平衡率
                string[] bphlpd = { "yzbphlpd", "ezbphlpd", "sanzbphlpd", "sizbphlpd", "wzbphlpd" };//不平衡率判定
                string[] zdpd = { "yzzdpd", "ezzdpd", "sanzzdpd", "sizzdpd", "wzzdpd" };//制动判定
                string[] zldtlh = { "yzzldtlh", "ezzldtlh", "sanzzldtlh", "sizzldtlh", "wzzldtlh" };//左轮动态轮荷
                string[] yldtlh = { "yzyldtlh", "ezyldtlh", "sanzyldtlh", "sizyldtlh", "wzyldtlh" };//右轮动态轮荷
                string[] zdlqx = { "yzzdlqx", "ezzdlqx", "sanzzdlqx", "sizzdlqx", "wzzdlqx" };//制动力曲线
                string[] zlsfbs = { "yzzlsfbs", "ezzlsfbs", "sanzzlsfbs", "sizzlsfbs", "wzzlsfbs" };//左轮是否抱死
                string[] ylsfbs = { "yzylsfbs", "ezylsfbs", "sanzylsfbs", "sizylsfbs", "wzylsfbs" };//右轮是否抱死

                string sclcsd = "";
                for (int ivax = 0; ivax < 5; ivax++)
                {
                    if(!jyxm.Contains("B"+ (ivax + 1)))
                    {
                        continue;
                    }
                    string a = "DET_WEIGHTZ" + (ivax + 1);
                    string b = "DET_WEIGHTY" + (ivax + 1);
                    string c = "DET_BRAKEL" + (ivax + 1);
                    string d = "DET_BRAKEY" + (ivax + 1);
                    string e = "DET_BRAKEDIFZ" + (ivax + 1);
                    string f = "DET_BRAKEDIFY" + (ivax + 1);
                    string g = "DET_BRIKEF" + (ivax + 1);
                    string h = "DET_BRIKEDIFF" + (ivax + 1);

                    string zdcs = "DET_BRIKECS" + (ivax + 1);
                    string fhz = "DET_WEIGHTFHZ" + (ivax + 1);
                    string fhy = "DET_WEIGHTFHY" + (ivax + 1);
                    string g_pd = "DET_BRIKEFJL" + (ivax + 1);
                    string h_pd = "DET_BRIKEDIFFJL" + (ivax + 1);
                    string zd_pd = "DET_ZZJL" + (ivax + 1);
                    string zd_qx = "DET_BRIKEQX" + (ivax + 1);
                    string xm = "";

                    string kzzh_sj = "";
                    if (jyxm.Contains("L") || int.Parse(zs) > 2)
                    {
                        float fh_z = 0, fh_y = 0;
                        float.TryParse(des.DeDES(dt.Rows[0][fhz].ToString()), out fh_z);
                        float.TryParse(des.DeDES(dt.Rows[0][fhy].ToString()), out fh_y);
                        kzzh_sj = (fh_z + fh_y).ToString();
                    }

                    if (ivax == 0) { xm = "B1"; sclcsd = string.Format("<clcsd>{0}</clcsd>", ""); }
                    if (ivax == 1) { xm = "B2"; sclcsd = string.Format("<clcsd>{0}</clcsd>", ""); }
                    if (ivax == 2) { xm = "B3"; }
                    if (ivax == 3) { xm = "B4"; }
                    if (ivax == 4) { xm = "B5"; }

                    #region B开始
                    StringBuilder vehispara18C55 = new StringBuilder();
                    vehispara18C55.AppendFormat("<root><vehispara>");
                    vehispara18C55.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                    vehispara18C55.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                    vehispara18C55.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                    vehispara18C55.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0][zdcs].ToString().Trim());
                    vehispara18C55.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                    vehispara18C55.AppendFormat("<hphm>{0}</hphm>", hphm);
                    vehispara18C55.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);

                    vehispara18C55.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "1");
                    vehispara18C55.AppendFormat("<jyxm>{0}</jyxm>", xm);
                    vehispara18C55.AppendFormat("<kssj>{0}</kssj>", getguocheng_time(jylsh, xm, "18C55"));
                    vehispara18C55.AppendFormat("</vehispara></root>");

                    var return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C55.ToString(), "", token);
                    

                    SaveLog(jylsh , xm + "开始",  vehispara18C55.ToString());
                    if (!return_message.Contains("成功"))
                    {
                        Savelog_erro(return_message, jylsh);
                        MessageBox.Show("上传" + xm + "开始失败");
                        return;
                    }
                    #endregion


                    #region B过程
                    string vehispara18C81 = string.Format("<?xml version=\"1.0\" encoding=\"GBK\"?>" + @"<root>
						<vehispara>
						<jylsh>{0}</jylsh>
						<jyjgbh>{1}</jyjgbh>
						<jcxdh>{2}</jcxdh>
                        <jyxm>{3}</jyxm>
						<jycs>{4}</jycs>
						<{20}>{5}</{20}>
						<{21}>{6}</{21}>
                        <{22}>{7}</{22}>
                        <{23}>{8}</{23}>
                        <{24}>{9}</{24}>
                        <{25}>{10}</{25}>
                        <{26}>{11}</{26}>
                        <{27}>{12}</{27}>
                        <{28}>{13}</{28}>
                        <{29}>{14}</{29}>
                        <{30}>{15}</{30}>
                        <{31}>{16}</{31}>
                        <{32}>{17}</{32}>
                        <{33}>{18}</{33}>
                        <{34}>{19}</{34}>
                        {35}
                        <{36}>{38}</{36}>
                        <{37}>{39}</{37}>
						</vehispara>
						</root>",
                            jylsh,
                            jyjgbh,
                            jcxdh,
                            xm,
                            des.DeDES(dt.Rows[0][zdcs].ToString().Trim()),
                            des.DeDES(dt.Rows[0][a].ToString().Trim()),
                            des.DeDES(dt.Rows[0][b].ToString().Trim()),
                            kzzh_sj,
                            des.DeDES(dt.Rows[0][c].ToString().Trim()),
                            des.DeDES(dt.Rows[0][d].ToString().Trim()),
                            des.DeDES(dt.Rows[0][e].ToString().Trim()),
                            des.DeDES(dt.Rows[0][f].ToString().Trim()),
                            des.DeDES(dt.Rows[0][g].ToString().Trim()),
                            dt.Rows[0][g_pd].ToString().Trim(),
                            des.DeDES(dt.Rows[0][h].ToString().Trim()),
                            dt.Rows[0][h_pd].ToString().Trim(),
                            dt.Rows[0][zd_pd].ToString().Trim(),
                            "",
                            "",
                            dt.Rows[0][zd_qx].ToString().Trim(),
                            zlz[ivax],
                            ylz[ivax],
                            kzzh[ivax],
                            qhzzdl[ivax],
                            qhyzdl[ivax],
                            qczzdl[ivax],
                            qcyzdl[ivax],
                            dll[ivax],
                            zdlpd[ivax],
                            bphl[ivax],
                            bphlpd[ivax],
                            zdpd[ivax],
                            zldtlh[ivax],
                            yldtlh[ivax],
                            zdlqx[ivax],
                            sclcsd,
                            zlsfbs[ivax],
                            ylsfbs[ivax],
                            "",
                            "0");
                    return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C81.ToString(), "", token);
 
                    SaveLog(jylsh , xm + "过程",  vehispara18C81.ToString());
                    if (!return_message.Contains("成功"))
                    {
                        Savelog_erro(return_message, jylsh);
                        MessageBox.Show("上传" + xm + "过程失败");
                        return;
                    }
                    #endregion

                    #region B结束
                    StringBuilder vehispara18C58 = new StringBuilder();
                    vehispara18C58.AppendFormat("<root><vehispara>");
                    vehispara18C58.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                    vehispara18C58.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                    vehispara18C58.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                    vehispara18C58.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0][zdcs].ToString().Trim());
                    vehispara18C58.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                    vehispara18C58.AppendFormat("<hphm>{0}</hphm>", hphm);
                    vehispara18C58.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);
                    vehispara18C58.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "1");
                    vehispara18C58.AppendFormat("<jyxm>{0}</jyxm>", xm);
                    vehispara18C58.AppendFormat("<jssj>{0}</jssj>", getguocheng_time(jylsh, xm, "18C58"));
                    vehispara18C58.AppendFormat("</vehispara></root>");

                    return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C58.ToString(), "", token);

                    SaveLog(jylsh , xm + "结束",  vehispara18C58.ToString());
                    if (!return_message.Contains("成功"))
                    {
                        Savelog_erro(return_message, jylsh);
                        MessageBox.Show("上传" + xm + "结束失败");
                        return;
                    }
                    #endregion

                }
            }
            if (jyxm.Contains("B0"))
            {
                #region B0开始
                StringBuilder vehispara18C55 = new StringBuilder();
                vehispara18C55.AppendFormat("<root><vehispara>");
                vehispara18C55.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C55.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C55.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C55.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_SSCS"].ToString().Trim());
                vehispara18C55.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C55.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C55.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);

                vehispara18C55.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "1");
                vehispara18C55.AppendFormat("<jyxm>{0}</jyxm>", "B0");
                vehispara18C55.AppendFormat("<kssj>{0}</kssj>", getguocheng_time(jylsh, "B0", "18C55"));
                vehispara18C55.AppendFormat("</vehispara></root>");

                var return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C55.ToString(), "", token);

                SaveLog(jylsh , "B0开始",  vehispara18C55.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传B0开始失败");
                    return;
                }
                #endregion

                #region B0过程
                string vehispara18C81 = string.Format("<?xml version=\"1.0\" encoding=\"GBK\"?>" + @"<root>
						<vehispara>
						<jylsh>{0}</jylsh>
						<jyjgbh>{1}</jyjgbh>
						<jcxdh>{2}</jcxdh>
                        <jyxm>{3}</jyxm>
						<jycs>{4}</jycs>
						<yzzczdl>{5}</yzzczdl>
						<ezzczdl>{6}</ezzczdl>
                        <sanzzczdl>{7}</sanzzczdl>
                        <sizzczdl>{8}</sizzczdl>
                        <wzzczdl>{9}</wzzczdl>
                        <zczczdl>{10}</zczczdl>
                        <tczzdl>{11}</tczzdl>
                        <tcyzdl>{12}</tcyzdl>
                        <tczdl>{13}</tczdl>
                        <tczdpd>{14}</tczdpd>
						</vehispara>
						</root>",
                  jylsh,
                  jyjgbh,
                  jcxdh,
                  "B0",
                  dt.Rows[0]["DET_SSCS"].ToString().Trim(),
                  des.DeDES(dt.Rows[0]["DET_HALTH1"].ToString().Trim()),
                  des.DeDES(dt.Rows[0]["DET_HALTH2"].ToString().Trim()),
                  des.DeDES(dt.Rows[0]["DET_HALTH3"].ToString().Trim()),
                  des.DeDES(dt.Rows[0]["DET_HALTH4"].ToString().Trim()),
                  des.DeDES(dt.Rows[0]["DET_HALTH5"].ToString().Trim()),
                  des.DeDES(dt.Rows[0]["DET_HALTH"].ToString().Trim()),
                  "",
                  "",
                  des.DeDES(dt.Rows[0]["DET_HALTF"].ToString().Trim()), 
                  dt.Rows[0]["DET_SSJL"].ToString().Trim()); 

                 return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C81.ToString(), "", token);

                SaveLog(jylsh , "B0过程",  vehispara18C81.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传B0过程失败");
                    return;
                }
                #endregion

                #region B0结束
                StringBuilder vehispara18C58 = new StringBuilder();
                vehispara18C58.AppendFormat("<root><vehispara>");
                vehispara18C58.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C58.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C58.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C58.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_SSCS"].ToString().Trim());
                vehispara18C58.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C58.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C58.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);

                vehispara18C58.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "1");
                vehispara18C58.AppendFormat("<jyxm>{0}</jyxm>", "B0");
                vehispara18C58.AppendFormat("<jssj>{0}</jssj>", getguocheng_time(jylsh, "B0", "18C58"));
                vehispara18C58.AppendFormat("</vehispara></root>");

                return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C58.ToString(), "", token);

                SaveLog(jylsh , "B0结束",  vehispara18C58.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传B0结束失败");
                    return;
                }
                #endregion
            }
            if (jyxm.Contains("L"))
            {
                for (int ivax = 0; ivax < 5; ivax++)
                {
                    string xm = "";
                    if (ivax == 0) xm = "L1";
                    if (ivax == 1) xm = "L2";
                    if (ivax == 2) xm = "L3";
                    if (ivax == 3) xm = "L4";
                    if (ivax == 4) xm = "L5";

                    string jz_cs = "DET_JZBRIKECS" + (ivax + 1);
                    string jz_qx = "DET_JZBRIKEQX" + (ivax + 1);
                    string jz_zdpd = "DET_JZBRIKEFJL" + (ivax + 1);
                    string jz_zdphpd = "DET_JZBRIKEDIFFJL" + (ivax + 1);
                    string l = "DET_WEIGHTHJZ" + (ivax + 1);
                    string m = "DET_JZBRIKEF" + (ivax + 1);
                    string n = "DET_JZBRIKEDIFF" + (ivax + 1);
                    string o = "DET_JZBRAKEL" + (ivax + 1);
                    string p = "DET_JZBRAKEY" + (ivax + 1);
                    string q = "DET_JZBRAKEDIFZ" + (ivax + 1);
                    string r = "DET_JZBRAKEDIFY" + (ivax + 1);
                    string t = "DET_WEIGHTHJZ" + (ivax + 1);

                    if (!jyxm.Contains(xm))
                    {
                        continue;
                    }
                    #region L开始
                    StringBuilder vehispara18C55 = new StringBuilder();
                    vehispara18C55.AppendFormat("<root><vehispara>");
                    vehispara18C55.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                    vehispara18C55.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                    vehispara18C55.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                    vehispara18C55.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0][jz_cs].ToString().Trim());
                    vehispara18C55.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                    vehispara18C55.AppendFormat("<hphm>{0}</hphm>", hphm);
                    vehispara18C55.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);

                    vehispara18C55.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "1");
                    vehispara18C55.AppendFormat("<jyxm>{0}</jyxm>", xm);
                    vehispara18C55.AppendFormat("<kssj>{0}</kssj>", getguocheng_time(jylsh, xm, "18C55"));
                    vehispara18C55.AppendFormat("</vehispara></root>");

                    var return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C55.ToString(), "", token);
                   
                    SaveLog(jylsh , xm + "开始",  vehispara18C55.ToString());
                    if (!return_message.Contains("成功"))
                    {
                        Savelog_erro(return_message, jylsh);
                        MessageBox.Show("上传" + xm + "开始失败");
                        return;
                    }
                    #endregion

                    #region L过程
                    string vehispara18C81 = string.Format("<?xml version=\"1.0\" encoding=\"GBK\"?>" + @"<root>
						<vehispara>
                        <jylsh>{0}</jylsh>
                        <jyjgbh>{1}</jyjgbh>
                        <jcxdh>{2}</jcxdh>
                        <jyxm>{3}</jyxm>
                        <jycs>{4}</jycs>
                        <jzzh>{5}</jzzh>
                        <qhzzdl>{6}</qhzzdl>
                        <qhyzdl>{7}</qhyzdl>
                        <qczzdl>{8}</qczzdl>
                        <qcyzdl>{9}</qcyzdl>
                        <dll>{10}</dll>
                        <zdlpd>{11}</zdlpd>
                        <bphl>{12}</bphl>
                        <bphlpd>{13}</bphlpd>
                        <zdpd>{14}</zdpd>
                        <zdlqx>{15}</zdlqx>                    
						</vehispara>
						</root>",
                        jylsh,
                        jyjgbh,
                        jcxdh,
                        xm,
                        dt.Rows[0][jz_cs].ToString().Trim(),
                        des.DeDES(dt.Rows[0][l].ToString().Trim()),
                        des.DeDES(dt.Rows[0][o].ToString().Trim()),
                        des.DeDES(dt.Rows[0][p].ToString().Trim()),
                        des.DeDES(dt.Rows[0][q].ToString().Trim()),
                        des.DeDES(dt.Rows[0][r].ToString().Trim()),
                        des.DeDES(dt.Rows[0][m].ToString().Trim()),
                        dt.Rows[0][jz_zdpd].ToString().Trim(),
                        des.DeDES(dt.Rows[0][n].ToString().Trim()),
                        dt.Rows[0][jz_zdphpd].ToString().Trim(),
                        (dt.Rows[0][jz_zdpd].ToString().Trim().Contains("1") && dt.Rows[0][jz_zdphpd].ToString().Trim().Contains("1")) ? "1" : "2",
                        dt.Rows[0][jz_qx].ToString().Trim());

                    return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C81.ToString(), "", token);
 
                    SaveLog(jylsh , xm + "过程",  vehispara18C81.ToString());
                    if (!return_message.Contains("成功"))
                    {
                        Savelog_erro(return_message, jylsh);
                        MessageBox.Show("上传" + xm + "过程失败");
                        return;
                    }
                    #endregion

                    #region L结束
                    StringBuilder vehispara18C58 = new StringBuilder();
                    vehispara18C58.AppendFormat("<root><vehispara>");
                    vehispara18C58.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                    vehispara18C58.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                    vehispara18C58.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                    vehispara18C58.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0][jz_cs].ToString().Trim());
                    vehispara18C58.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                    vehispara18C58.AppendFormat("<hphm>{0}</hphm>", hphm);
                    vehispara18C58.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);
                    vehispara18C58.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "1");
                    vehispara18C58.AppendFormat("<jyxm>{0}</jyxm>", xm);
                    vehispara18C58.AppendFormat("<jssj>{0}</jssj>", getguocheng_time(jylsh, xm, "18C58"));
                    vehispara18C58.AppendFormat("</vehispara></root>");

                    return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C58.ToString(), "", token);

                    SaveLog(jylsh , xm + "结束",  vehispara18C58.ToString());
                    if (!return_message.Contains("成功"))
                    {
                        Savelog_erro(return_message, jylsh);
                        MessageBox.Show("上传" + xm + "结束失败");
                        return;
                    }
                    #endregion
                }
            }
            if (jyxm.Contains("M"))
            {
                #region M开始
                StringBuilder vehispara18C55 = new StringBuilder();
                vehispara18C55.AppendFormat("<root><vehispara>");
                vehispara18C55.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C55.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C55.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C55.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_WKCCCS"].ToString().Trim());
                vehispara18C55.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C55.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C55.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);

                vehispara18C55.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "1");
                vehispara18C55.AppendFormat("<jyxm>{0}</jyxm>", "M1");
                vehispara18C55.AppendFormat("<kssj>{0}</kssj>", getguocheng_time(jylsh, "M1", "18C55"));
                vehispara18C55.AppendFormat("</vehispara></root>");

                var return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C55.ToString(), "", token);

                SaveLog(jylsh, "M1开始", vehispara18C55.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传M1开始失败");
                    return;
                }
                #endregion
                #region M过程
                StringBuilder vehispara18C81WKCC = new StringBuilder();
                vehispara18C81WKCC.AppendFormat("<root><vehispara>");
                vehispara18C81WKCC.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C81WKCC.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C81WKCC.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C81WKCC.AppendFormat("<jyxm>{0}</jyxm>", "M1");
                vehispara18C81WKCC.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_WKCCCS"].ToString().Trim());
                vehispara18C81WKCC.AppendFormat("<cwkc>{0}</cwkc>", des.DeDES(dt.Rows[0]["DET_WKCCC"].ToString().Trim()));
                vehispara18C81WKCC.AppendFormat("<cwkk>{0}</cwkk>", des.DeDES(dt.Rows[0]["DET_WKCCK"].ToString().Trim()));
                vehispara18C81WKCC.AppendFormat("<cwkg>{0}</cwkg>", des.DeDES(dt.Rows[0]["DET_WKCCG"].ToString().Trim()));
                vehispara18C81WKCC.AppendFormat("<clwkccpd>{0}</clwkccpd>", dt.Rows[0]["DET_WKCCJL"].ToString().Trim());
                vehispara18C81WKCC.AppendFormat("</vehispara></root>");

                return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C81WKCC.ToString(), "", token);

                SaveLog(jylsh, "M1过程", vehispara18C81WKCC.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传M1过程失败");
                    return;
                }
                #endregion
                #region M结束
                StringBuilder vehispara18C58 = new StringBuilder();
                vehispara18C58.AppendFormat("<root><vehispara>");
                vehispara18C58.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C58.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C58.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C58.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_WKCCCS"].ToString().Trim());
                vehispara18C58.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C58.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C58.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);
                vehispara18C58.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "1");
                vehispara18C58.AppendFormat("<jyxm>{0}</jyxm>", "M1");
                vehispara18C58.AppendFormat("<jssj>{0}</jssj>", getguocheng_time(jylsh, "M1", "18C58"));
                vehispara18C58.AppendFormat("</vehispara></root>");

                return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C58.ToString(), "", token);

                SaveLog(jylsh, "M1结束", vehispara18C58.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传M1结束失败");
                    return;
                }
                #endregion
            }
            if (jyxm.Contains("Z"))
            {
                #region Z开始
                StringBuilder vehispara18C55 = new StringBuilder();
                vehispara18C55.AppendFormat("<root><vehispara>");
                vehispara18C55.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C55.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C55.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C55.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_ZBZLCS"].ToString().Trim());
                vehispara18C55.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C55.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C55.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);

                vehispara18C55.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "1");
                vehispara18C55.AppendFormat("<jyxm>{0}</jyxm>", "Z1");
                vehispara18C55.AppendFormat("<kssj>{0}</kssj>", getguocheng_time(jylsh, "Z1", "18C55"));
                vehispara18C55.AppendFormat("</vehispara></root>");

                var return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C55.ToString(), "", token);

                SaveLog(jylsh, "Z1开始", vehispara18C55.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传Z1开始失败");
                    return;
                }
                #endregion

                #region Z过程
                double izbzljcz = 0;
                double izbzl = 0;
                double.TryParse(des.DeDES(dt.Rows[0]["DET_ZBZL"].ToString().Trim()), out izbzljcz);
                double.TryParse(dt.Rows[0]["AT_ZBZL"].ToString().Trim(), out izbzl);
                double bl = Math.Round((izbzljcz - izbzl) / izbzl * 100, 1);
                StringBuilder vehispara18C81WKCC = new StringBuilder();
                vehispara18C81WKCC.AppendFormat("<root><vehispara>");
                vehispara18C81WKCC.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C81WKCC.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C81WKCC.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C81WKCC.AppendFormat("<jyxm>{0}</jyxm>", "Z1");
                vehispara18C81WKCC.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_ZBZLCS"].ToString().Trim());
                vehispara18C81WKCC.AppendFormat("<zbzl>{0}</zbzl>", des.DeDES(dt.Rows[0]["DET_ZBZL"].ToString().Trim()));
                //vehispara18C81WKCC.AppendFormat("<clzl>{0}</clzl>", "");
                //vehispara18C81WKCC.AppendFormat("<wbzl>{0}</wbzl>", "");
                //vehispara18C81WKCC.AppendFormat("<qtbjzl>{0}</qtbjzl>", "");
                //vehispara18C81WKCC.AppendFormat("<qtbjsm>{0}</qtbjsm>", "");
                vehispara18C81WKCC.AppendFormat("<bzzczbzl>{0}</bzzczbzl>", dt.Rows[0]["AT_ZBZL"].ToString().Trim());
                vehispara18C81WKCC.AppendFormat("<zczbzlbfb>{0}</zczbzlbfb>", bl);
                vehispara18C81WKCC.AppendFormat("<zbzlpd>{0}</zbzlpd>", dt.Rows[0]["DET_ZBZLJL"].ToString().Trim());
                vehispara18C81WKCC.AppendFormat("</vehispara></root>");

                return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C81WKCC.ToString(), "", token);

                SaveLog(jylsh, "Z1过程", vehispara18C81WKCC.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传Z1过程失败");
                    return;
                }
                #endregion

                #region Z结束
                StringBuilder vehispara18C58 = new StringBuilder();
                vehispara18C58.AppendFormat("<root><vehispara>");
                vehispara18C58.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C58.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C58.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C58.AppendFormat("<jycs>{0}</jycs>", dt.Rows[0]["DET_ZBZLCS"].ToString().Trim());
                vehispara18C58.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C58.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C58.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);
                vehispara18C58.AppendFormat("<gwjysbbh>{0}</gwjysbbh>", "1");
                vehispara18C58.AppendFormat("<jyxm>{0}</jyxm>", "Z1");
                vehispara18C58.AppendFormat("<jssj>{0}</jssj>", getguocheng_time(jylsh, "Z1", "18C58"));
                vehispara18C58.AppendFormat("</vehispara></root>");

                return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C58.ToString(), "", token);

                SaveLog(jylsh, "Z1结束", vehispara18C58.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传Z1结束失败");
                    return;
                }
                #endregion

                #region 18C82结果
                string vehispara18C82 = "";
                string stoubao18C82 = "<?xml version=\"1.0\" encoding=\"GBK\"?>";
                vehispara18C82 = stoubao18C82 + string.Format(@"<root><vehispara>
                            <jylsh>{0}</jylsh>
                            <jyjgbh>{1}</jyjgbh>
                            <jcxdh>{2}</jcxdh>
                            <hphm>{3}</hphm>
                            <hpzl>{4}</hpzl>
                            <clsbdh>{5}</clsbdh>
                            <ycyxm>{6}</ycyxm>
                            <ycysfzh>{7}</ycysfzh>
                            <zczdl>{8}</zczdl>
                            <zczdpd>{9}</zczdpd>
                           <qycjyfs>{10}</qycjyfs>
                            <zchphm>{11}</zchphm>
                            <zczqyzzl>{12}</zczqyzzl>
                             <zczdjyjg>{13}</zczdjyjg>
                             <zdjccs>{14}</zdjccs>
                            <zcpd>{15}</zcpd>
                            <zjccs>{16}</zjccs>
                            <bz>{17}</bz>
                            </vehispara></root>",
                           jylsh,
                           jyjgbh,
                           jcxdh,
                           hphm,
                           hpzl,
                           clsbdh,
                           ycy,
                           "",//身份证
                           des.DeDES(dt.Rows[0]["DET_BRAKEF"].ToString().Trim()),//整车制动率
                           dt.Rows[0]["DET_ZCJL"].ToString().Trim(),//整车制动判定
                           "",
                           dt.Rows[0]["AT_ZCHPHM"].ToString().Trim(),
                           dt.Rows[0]["AT_ZQYZL"].ToString().Trim(),
                           hpzl.Contains("挂") ? "1" : "0",//主车制动检验结果
                           dt.Rows[0]["DET_ZCCS"].ToString().Trim(),//整车制动次数
                           dt.Rows[0]["DET_JYZJL"].ToString().Trim(),//整车判定
                           jycs,//总检验次数
                           "");

                return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C82.ToString(), "", token);

                SaveLog(jylsh, "18C82结果", vehispara18C81WKCC.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传18C82结果失败");
                    return;
                }
                #endregion
            }
            #endregion
            MessageBox.Show("上传数据完成");

            ////3.4	提交照片数据
            #region
            {
                var zp = "";
                var pssj = "";
                var zpzl = "";

                szpzl = new string[] { "A110", "A111", "0322", "0348", "0349", "0350", "0354", "ZJ14", "ZJ15" };//今后这里可以修改为读取数据

                for (int i = 0; i < szpzl.Length; i++)
                {
                    var returnstring = GetPicture.ReadPicture(urlAJ, jylsh, szpzl[i]);

                    if (returnstring.Contains("失败"))
                    {
                        continue;
                    }
                    JObject jsonobject = JObject.Parse(returnstring);
                    string data = (string)jsonobject["data"].ToString();

                    JArray jsonarray = JArray.Parse(data);
                    JObject firstobject = (JObject)jsonarray[0];
                    string return_shujuliu = firstobject["shujuliu"].ToString().Trim();
                    string return_pssj = firstobject["zptime"].ToString().Trim();

                    if (!string.IsNullOrWhiteSpace(return_shujuliu))
                    {
                        zp = "data:image/jpg;base64," + return_shujuliu;
                        pssj = return_pssj;
                        zpzl = szpzl[i];
                        if (szpzl[i] == "ZJ14")
                        {
                            zpzl = "A309";
                        }
                        if (szpzl[i] == "ZJ15")
                        {
                            zpzl = "A310";
                        }
                        StringBuilder vehispara18c63 = new StringBuilder();
                        vehispara18c63.AppendFormat("<root><vehispara>");
                        vehispara18c63.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                        vehispara18c63.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                        vehispara18c63.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                        vehispara18c63.AppendFormat("<jycs>{0}</jycs>", 1);
                        vehispara18c63.AppendFormat("<hphm>{0}</hphm>", hphm);
                        vehispara18c63.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                        vehispara18c63.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);
                        vehispara18c63.AppendFormat("<zp>{0}</zp>", zp);
                        vehispara18c63.AppendFormat("<pssj>{0}</pssj>", pssj);
                        vehispara18c63.AppendFormat("<jyxm>{0}</jyxm>", "F1");
                        vehispara18c63.AppendFormat("<zpzl>{0}</zpzl>", zpzl);
                        vehispara18c63.AppendFormat("</vehispara></root>");

                        var return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18c63.ToString(), "", token);

                        SaveLog(jylsh, "图片" + "_" + szpzl[i], vehispara18c63.ToString());
                        if (!return_message.Contains("成功"))
                        {
                            Savelog_erro(return_message, jylsh);
                            MessageBox.Show("上传图片" + "_" + szpzl[i] + "失败");
                            return;
                        }
                    }
                }
                MessageBox.Show("上传图片数据完成");
            }

            #endregion

            //3.5	完成检测
            #region
            {
                string vehispara18C59 = "";
                string stoubao18C59 = "<?xml version=\"1.0\" encoding=\"GBK\"?>";
                vehispara18C59 = stoubao18C59 + string.Format(@"<root><vehispara>
                                        <jylsh>{0}</jylsh>
                                        <jyjgbh>{1}</jyjgbh>
                                        <jcxdh>{2}</jcxdh>
                                        <jycs>{3}</jycs>
                                        <hpzl>{4}</hpzl>
                                        <hphm>{5}</hphm>
                                        <clsbdh>{6}</clsbdh>
                                        <jssj>{7}</jssj>
                                        </vehispara></root>",
                                            jylsh,
                                            jyjgbh,
                                            jcxdh,
                                            jycs,
                                            hpzl,
                                            hphm,
                                            clsbdh,
                                           DateTime.Parse(dt.Rows[0]["DET_JYDATE"].ToString().Trim()).ToString("yyyy-MM-dd HH:mm:ss"));//??????

                string return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C59.ToString(), "", token);

                SaveLog(jylsh, "18C59结果", vehispara18C59.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传18C59结果失败");
                    return;
                }
            }

            #endregion

            //3.6	提交检验总评结果
            #region
            {
                string ssqqzrls = "";
                string ssqqzr = dt.Rows[0]["SI_SQQZR"].ToString().Trim();
                bool sxqzr = dt.Rows[0]["SI_SXQZR"].ToString().Trim().Contains("True");
                if (ssqqzr.Contains(","))
                {
                    string[] ssqqzrs = ssqqzr.Split(',');
                    ssqqzrls = ssqqzrs[0];
                }
                else
                {
                    ssqqzrls = ssqqzr;
                }
                if (sxqzr)
                {
                    if (!string.IsNullOrEmpty(dt.Rows[0]["DET_SQQZR"].ToString().Trim()))
                    {
                        ssqqzrls = dt.Rows[0]["DET_SQQZR"].ToString().Trim();

                    }

                }
                string jyjl = "合格";
                StringBuilder rgjyjg = new StringBuilder();
                int count = 1;
                rgjyjg.AppendFormat("<rgjyjg><xh>{0}</xh><rgjyxm>{1}</rgjyxm><rgjgpd>1</rgjgpd><rgjysm></rgjysm><rgjybz></rgjybz></rgjyjg>", count++, encode("联网查询"));
                rgjyjg.AppendFormat("<rgjyjg><xh>{0}</xh><rgjyxm>{1}</rgjyxm><rgjgpd>1</rgjgpd><rgjysm></rgjysm><rgjybz></rgjybz></rgjyjg>", count++, encode("车辆唯一性检查"));
                rgjyjg.AppendFormat("<rgjyjg><xh>{0}</xh><rgjyxm>{1}</rgjyxm><rgjgpd>1</rgjgpd><rgjysm></rgjysm><rgjybz></rgjybz></rgjyjg>", count++, encode("车辆特征参数检查"));
                rgjyjg.AppendFormat("<rgjyjg><xh>{0}</xh><rgjyxm>{1}</rgjyxm><rgjgpd>1</rgjgpd><rgjysm></rgjysm><rgjybz></rgjybz></rgjyjg>", count++, encode("车辆外观检查"));
                if (!hpzl.Contains("摩托"))
                {
                    rgjyjg.AppendFormat("<rgjyjg><xh>{0}</xh><rgjyxm>{1}</rgjyxm><rgjgpd>1</rgjgpd><rgjysm></rgjysm><rgjybz></rgjybz></rgjyjg>", count++, encode("安全装置检查"));
                }
                if (dt.Rows[0]["DET_JYXM"].ToString().Trim().Contains("DC"))
                {
                    rgjyjg.AppendFormat("<rgjyjg><xh>{0}</xh><rgjyxm>{1}</rgjyxm><rgjgpd>1</rgjgpd><rgjysm></rgjysm><rgjybz></rgjybz></rgjyjg>", count++, encode("底盘动态检验"));
                }
                if (dt.Rows[0]["DET_JYXM"].ToString().Trim().Contains("C1"))
                {
                    rgjyjg.AppendFormat("<rgjyjg><xh>{0}</xh><rgjyxm>{1}</rgjyxm><rgjgpd>1</rgjgpd><rgjysm></rgjysm><rgjybz></rgjybz></rgjyjg>", count++, encode("车辆底盘部件检查"));
                }

                string sqlPD = string.Format(@"Select * From PD_AJ Where DETECT_ID='{0}' order by DETECT_ID desc", det_id);

                dt = mquery.GetTable(sqlPD);

                StringBuilder syqsb = new StringBuilder();
                string jybgjy = "";
                if (dt.Rows.Count > 0)
                {
                    jybgjy = dt.Rows[0]["jianyi"].ToString().Trim();
                    int ixh = 1;
                    List<string> PDzd = new List<string>();
                    PDzd.Add("PD_LUSHI");
                    PDzd.Add("PD_KZCSD");
                    PDzd.Add("PD_KZZDJL");
                    PDzd.Add("PD_KZMFDD");
                    PDzd.Add("PD_BRIKE1");
                    PDzd.Add("PD_BRIKE2");
                    PDzd.Add("PD_BRIKE3");
                    PDzd.Add("PD_BRIKE4");
                    PDzd.Add("PD_BRIKE5");
                    PDzd.Add("PD_JZBRLKE1");
                    PDzd.Add("PD_JZBRLKE2");
                    PDzd.Add("PD_JZBRLKE3");
                    PDzd.Add("PD_JZBRLKE4");
                    PDzd.Add("PD_zhengche");
                    PDzd.Add("PD_ZHUCHE");
                    PDzd.Add("PD_ZWDGQ");
                    PDzd.Add("PD_YWDGQ");
                    PDzd.Add("PD_SLIP");
                    PDzd.Add("PD_WKCC");
                    PDzd.Add("PD_ZBZL");
                    PDzd.Add("PD_XTSJ");
                    PDzd.Add("PD_PJ");

                    for (int i = 0; i < PDzd.Count; i++)
                    {
                        string spd = dt.Rows[0][PDzd[i]].ToString().Trim();
                        if (spd.Contains("不合格"))
                        {
                            jyjl = "不合格";
                        }
                        if (spd.Contains(","))
                        {
                            string[] sdatazs = spd.Split(new char[] { ',' });
                            syqsb.AppendFormat(@"<yqsbjyjg><xh>{0}</xh><yqjyxm>{1}</yqjyxm><yqjyjg>{2}</yqjyjg><yqbzxz>{3}</yqbzxz><yqjgpd>{4}</yqjgpd><yqjybz>{5}</yqjybz></yqsbjyjg>",
                             ixh++, encode(sdatazs[0]).Replace("(%)", ""),
                             encode(sdatazs[1]),
                             encode(sdatazs[2]),
                             sdatazs[3].Contains("不合格") ? "2" : (sdatazs[3].Contains("合格") ? "1" : "3"),
                           sdatazs.Length >= 5 ? encode(sdatazs[4]) : "");
                        }
                    }
                }


                StringBuilder vehispara18C62 = new StringBuilder();
                vehispara18C62.AppendFormat("<root><vehispara>");
                vehispara18C62.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C62.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C62.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C62.AppendFormat("<jycs>{0}</jycs>", jycs);
                vehispara18C62.AppendFormat("<hphm>{0}</hphm>", hphm);
                vehispara18C62.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                vehispara18C62.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);
                vehispara18C62.AppendFormat("<jyjl>{0}</jyjl>", jyjl);
                vehispara18C62.AppendFormat("<pzrxm>{0}</pzrxm>", ssqqzrls);
                vehispara18C62.AppendFormat("<rgjyjgs>{0}</rgjyjgs>", rgjyjg.ToString());
                vehispara18C62.AppendFormat("<yqsbjyjgs>{0}</yqsbjyjgs>", syqsb.ToString());
                vehispara18C62.AppendFormat("<jybgjy>{0}</jybgjy>", encode(jybgjy));
                vehispara18C62.AppendFormat("<jybgbz>{0}</jybgbz>", "");
                vehispara18C62.AppendFormat("</vehispara></root>");

                string return_message = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C62.ToString(), "", token);

                SaveLog(jylsh, "18C62结果", vehispara18C62.ToString());
                if (!return_message.Contains("成功"))
                {
                    Savelog_erro(return_message, jylsh);
                    MessageBox.Show("上传18C62结果失败");
                    return;
                }
            }
            #endregion


            MessageBox.Show("上传完成");
        }
        public void get_38900数据(string jylsh)
        {
           var jyjgbh="";
           var jcxdh = "1";
           var hpzl = "";
           var hphm = "";
           var clsbdh = "";
           var token = getToken();
           string cwkc = "0";
           string cwkk = "0";
           string cwkg = "0";
           // 3.2	开始一个检测流程
           #region
           Query mquery = new Query();
            string sql;
            sql = string.Format(@"Select * from WriteLog where jylsh='{0}' and jkid='{1}' ", jylsh,"18C51");
            DataTable dt = mquery.GetTable(sql);
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {

                    var data = DecodeBase64("utf-8", dt.Rows[i]["WriteXmlDoc"].ToString().Trim());
                 
                    

                    XmlDocument xmlstr = new XmlDocument();
                    xmlstr.LoadXml(data);

                    jyjgbh=  data.Contains("<jyjgbh>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/jyjgbh").InnerText) : "";
                    jcxdh =  data.Contains("<jcxdh>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/jcxdh").InnerText) : "1";
                    hpzl =   data.Contains("<hpzl>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/hpzl").InnerText) : "";
                    hphm = data.Contains("<hphm>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/hphm").InnerText) : "";

                    string sbdhpzl = getsqlmessage2("table_hpzl", hpzl);
                    sql = string.Format(@"Select * from AUTO where AT_HPHM='{0}' and AT_HPZL='{1}'", hphm, sbdhpzl);
                    DataTable dts = mquery.GetTable(sql);
                    string zws = "";
                    string hzzl = "";
                    string csys = "";
                    string dlyszh = "";
                    string ccdjrq = "";
                    string rlzl = "";
                    string syr = data.Contains("<syr>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/syr").InnerText) : "";
                    if (dts.Rows.Count > 0)
                    {
                        syr = dts.Rows[0]["AT_SYR"].ToString().Trim();
                        zws = dts.Rows[0]["AT_HDZK"].ToString().Trim();
                        hzzl = dts.Rows[0]["AT_HDZZL"].ToString().Trim();
                        dlyszh = dts.Rows[0]["AT_DLYSZ"].ToString().Trim();
                        csys = GetCsysCode(dts.Rows[0]["AT_CSYS"].ToString().Trim());
                        cwkc = dts.Rows[0]["AT_HXCHANG"].ToString().Trim();
                        cwkk = dts.Rows[0]["AT_HXKUAN"].ToString().Trim();
                        cwkg = dts.Rows[0]["AT_HXGAO"].ToString().Trim();
                        ccdjrq = DateTime.Parse(dts.Rows[0]["AT_CCDJRQ"].ToString()).ToString("yyyy-MM-dd");
                        rlzl = string.IsNullOrEmpty(dts.Rows[0]["AT_RYZL"].ToString().Trim()) ? "A" : dts.Rows[0]["AT_RYZL"].ToString().Trim().Substring(0,1);
                    }
                    if (hpzl.Contains("16"))
                    {
                        hphm = data.Contains("<hphm>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/hphm").InnerText)+"学" : "";
                    }

                    clsbdh = data.Contains("<clsbdh>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/clsbdh").InnerText) : "";
                    if ((jcxdh + "").Length < 1)
                    {
                        jcxdh = "1";
                    }
               
                    string vehispara = "";
                   
                    vehispara = string.Format(@"<root><vehispara>
                <jylsh>{0}</jylsh>
				<jyjgbh>{1}</jyjgbh>
				<jcxdh>{2}</jcxdh>
				<xh>{3}</xh>
				<hpzl>{4}</hpzl>
				<hphm>{5}</hphm>
				<clsbdh>{6}</clsbdh>
				<fdjh>{7}</fdjh>
				<csys>{8}</csys>
				<syxz>{9}</syxz>
                <ccdjrq>{10}</ccdjrq>
                <jyrq>{11}</jyrq>
                <jyyxqz>{12}</jyyxqz>
                <bxzzrq>{13}</bxzzrq>
                <rlzl>{14}</rlzl>
                <gl>{15}</gl>
                <zs>{16}</zs>
                <zj>{17}</zj>
                <qlj>{18}</qlj>
                <hlj>{19}</hlj>
                <zzl>{20}</zzl>
                <zbzl>{21}</zbzl>
                <ccrq>{22}</ccrq>
                <qdxs>{23}</qdxs>
                <zczs>{24}</zczs>
                <zczw>{25}</zczw>
                <zzs>{26}</zzs>
                <zzly>{27}</zzly>
                <qzdz>{28}</qzdz>
                <zxzxjxs>{29}</zxzxjxs>
                <lcbds>{30}</lcbds>
                <jylb>{31}</jylb>
                <jyxm>{32}</jyxm>
                <bhgx>{33}</bhgx>
                <dlsj>{34}</dlsj>
                <jycs>{35}</jycs>
                <dly>{36}</dly>
                <ycy>{37}</ycy>
                <wjy>{38}</wjy>
                <dtjyy>{39}</dtjyy>
                <dpjyy>{40}</dpjyy>
                <clpp1>{41}</clpp1>
                <clxh>{42}</clxh>
                <syr>{43}</syr>
                <cllx>{44}</cllx>
                <cwkc>{45}</cwkc>
                <cwkk>{46}</cwkk>
                <cwkg>{47}</cwkg>
                <clyt>{48}</clyt>
                <ytsx>{49}</ytsx>
                <dlysfzh>{50}</dlysfzh>
                <ycysfzh>{51}</ycysfzh>
                <wjysfzh>{52}</wjysfzh>
                <dtjyysfzh>{53}</dtjyysfzh>
                <dpjyysfzh>{54}</dpjyysfzh>
                <clsslb>{55}</clsslb>
                <jcxlb>{56}</jcxlb>
                <sjr>{57}</sjr>
                <sjrsfzh>{58}</sjrsfzh>
                <qzs>{59}</qzs>
                <bzzw>{60}</bzzw>
                <dlyszh>{61}</dlyszh>
                <jylbzl>{62}</jylbzl>
                <sfqszxz>{63}</sfqszxz>
                <sfazwb>{64}</sfazwb>
                <wbzl>{65}</wbzl>
                <wbspcd>{66}</wbspcd>
                <zkrs>{67}</zkrs>
                <hdzzl>{68}</hdzzl>
                </vehispara>
                </root>",
                data.Contains("<jylsh>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/jylsh").InnerText) : "",
                data.Contains("<jyjgbh>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/jyjgbh").InnerText) : "",
                "A",
                data.Contains("<xh>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/xh").InnerText) : "",
                data.Contains("<hpzl>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/hpzl").InnerText) : "",
                hphm,
                data.Contains("<clsbdh>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/clsbdh").InnerText) : "",
                data.Contains("<fdjh>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/fdjh").InnerText) : "",
                csys,
                data.Contains("<syxz>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/syxz").InnerText) : "",
                ccdjrq,
                data.Contains("<jyrq>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/jyrq").InnerText) : "",
                data.Contains("<jyyxqz>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/jyyxqz").InnerText) : "",
                data.Contains("<bxzzrq>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/bxzzrq").InnerText) : "",
                rlzl,
                data.Contains("<gl>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/gl").InnerText) : "",
                data.Contains("<zs>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/zs").InnerText) : "",
                data.Contains("<zj>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/zj").InnerText) : "",
                data.Contains("<qlj>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/qlj").InnerText) : "",
                data.Contains("<hlj>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/hlj").InnerText) : "",
                data.Contains("<zzl>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/zzl").InnerText) : "",
                data.Contains("<zbzl>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/zbzl").InnerText) : "",
                data.Contains("<ccrq>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/ccrq").InnerText) : "",
                data.Contains("<qdxs>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/qdxs").InnerText) : "",
                data.Contains("<zczs>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/zczs").InnerText) : "",
                data.Contains("<zczw>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/zczw").InnerText) : "",
                data.Contains("<zzs>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/zzs").InnerText) : "",
                //data.Contains("<zzly>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/zzly").InnerText) : "0",
                "1",
                data.Contains("<qzdz>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/qzdz").InnerText) : "",
                data.Contains("<zxzxjxs>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/zxzxjxs").InnerText) : "",
                data.Contains("<lcbds>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/lcbds").InnerText) : "",
                data.Contains("<jylb>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/jylb").InnerText) : "",
                data.Contains("<jyxm>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/jyxm").InnerText) : "",
                data.Contains("<bhgx>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/bhgx").InnerText) : "",
                data.Contains("<dlsj>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/dlsj").InnerText) : "",
                data.Contains("<jycs>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/jycs").InnerText) : "",
                data.Contains("<dly>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/dly").InnerText) : "",
                ycy,
                data.Contains("<wjy>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/wjy").InnerText) : "",
                data.Contains("<dtjyy>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/dtjyy").InnerText) : "",
                data.Contains("<dpjyy>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/dpjyy").InnerText) : "",
                data.Contains("<clpp1>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/clpp1").InnerText) : "",
                data.Contains("<clxh>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/clxh").InnerText) : "",
                syr,
                data.Contains("<cllx>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/cllx").InnerText) : "",
                data.Contains("<cwkc>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/cwkc").InnerText) : "",
                data.Contains("<cwkk>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/cwkk").InnerText) : "",
                data.Contains("<cwkg>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/cwkg").InnerText) : "",
                data.Contains("<clyt>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/clyt").InnerText) : "",
                data.Contains("<ytsx>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/ytsx").InnerText) : "",
                data.Contains("<dlysfzh>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/dlysfzh").InnerText) : "",
                data.Contains("<ycysfzh>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/ycysfzh").InnerText) : "",
                data.Contains("<wjysfzh>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/wjysfzh").InnerText) : "",
                data.Contains("<dtjyysfzh>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/dtjyysfzh").InnerText) : "",
                data.Contains("<dpjyysfzh>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/dpjyysfzh").InnerText) : "",
                data.Contains("<clsslb>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/clsslb").InnerText) : "",
                data.Contains("<jcxlb>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/jcxlb").InnerText) : "",
                data.Contains("<sjr>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/sjr").InnerText) : "",
                data.Contains("<sjrsfzh>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/sjrsfzh").InnerText) : "",
                data.Contains("<qzs>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/qzs").InnerText) : "",
                data.Contains("<bzzw>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/bzzw").InnerText) : "",
                dlyszh,
                data.Contains("<jylbzl>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/jylbzl").InnerText) : "",
                data.Contains("<sfqszxz>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/sfqszxz").InnerText) : "",
                data.Contains("<sfazwb>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/sfazwb").InnerText) : "",
                data.Contains("<wbzl>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/wbzl").InnerText) : "",
                data.Contains("<wbspcd>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/wbspcd").InnerText) : "" ,
                zws,
                hzzl);
                    //data.Contains("<syr>") ? decode(xmlstr.SelectSingleNode("/root/vehispara/syr").InnerText) : ""
                    string surl = string.Format("{0}/uploaddata", urlZJ);
                    string sjieguo = Post(surl, vehispara, "", token);

                    XmlDocument xmlstr_1 = new XmlDocument();
                    xmlstr_1.LoadXml(sjieguo);
                    if(! (xmlstr_1.SelectSingleNode("/root/code").InnerText == "1"))
                    {
                        //MessageBox.Show(xmlstr_1.SelectSingleNode("/root/message").InnerText);
                        MessageBox.Show("发送："+vehispara +"\r\n接收："+ sjieguo);
                   
                    }
                   

                    
                }
            }
           #endregion

            //3.3	提交数据
            #region

            var flag = "";//已经上传内容

            sql = string.Format(@"Select * from WriteLog   where jylsh='{0}' and jkid not in('18C52','18C59','18C51','18C65','18C62','18C64','18C61','18C66') order by WriteLog_id desc ", jylsh);
            //sql = string.Format(@"Select * from WriteLog   where jylsh='{0}' and jkid not in('18C55','18C58','18C52','18C59','18C51','18C65','18C62','18C64','18C61','18C66') order by WriteLog_id desc ", jylsh);
             dt = mquery.GetTable(sql);
            if (dt.Rows.Count > 0)
            {

                XmlDocument xmlstr_1 = new XmlDocument();

                {
                    StringBuilder vehispara18C81WKCC = new StringBuilder();
                    vehispara18C81WKCC.AppendFormat("<root><vehispara>");
                    vehispara18C81WKCC.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                    vehispara18C81WKCC.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                    vehispara18C81WKCC.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                    vehispara18C81WKCC.AppendFormat("<jyxm>{0}</jyxm>", "M1");
                    vehispara18C81WKCC.AppendFormat("<jycs>{0}</jycs>", 1);

                    vehispara18C81WKCC.AppendFormat("<cwkc>{0}</cwkc>", cwkc);
                    vehispara18C81WKCC.AppendFormat("<cwkk>{0}</cwkk>", cwkk);
                    vehispara18C81WKCC.AppendFormat("<cwkg>{0}</cwkg>", cwkg);

                    vehispara18C81WKCC.AppendFormat("<clwkccpd>{0}</clwkccpd>", 1);
                    vehispara18C81WKCC.AppendFormat("</vehispara></root>");


                    Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C81WKCC.ToString(), "", token);

                }

                StringBuilder vehispara18C81 = new StringBuilder();
                vehispara18C81.AppendFormat("<root><vehispara>");
                vehispara18C81.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                vehispara18C81.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                vehispara18C81.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                vehispara18C81.AppendFormat("<jyxm>{0}</jyxm>", "B0");
                vehispara18C81.AppendFormat("<jycs>{0}</jycs>", 1);


                vehispara18C81.AppendFormat("<tczdpd>{0}</tczdpd>", 1);
                vehispara18C81.AppendFormat("</vehispara></root>");
                Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C81.ToString(), "", token);

                //string sjieguo = Post(string.Format("{0}/uploaddata", urlZJ), vehispara18C81.ToString(), "", token);
                //xmlstr_1.LoadXml(sjieguo);
                //if ((xmlstr_1.SelectSingleNode("/root/code").InnerText != "1"))
                //{
                //    MessageBox.Show(xmlstr_1.SelectSingleNode("/root/message").InnerText);
                //}
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if(dt.Rows[i]["jkid"].ToString().Trim()=="18C55"||dt.Rows[i]["jkid"].ToString().Trim()=="18C58")
                    {
                        if (!(dt.Rows[i]["jyxm"].ToString().Trim() == "UC" || dt.Rows[i]["jyxm"].ToString().Trim() == "NQ" || dt.Rows[i]["jyxm"].ToString().Trim() == "F1" || dt.Rows[i]["jyxm"].ToString().Trim() == "DC" || dt.Rows[i]["jyxm"].ToString().Trim() == "C1"))
                        {
                            continue;
                        }
                    }
                    var jyxm = dt.Rows[i]["jkid"].ToString().Trim() + dt.Rows[i]["jyxm"].ToString().Trim();
                    if (!flag.Contains(jyxm))
                        {
                            flag = flag + ";" + jyxm;
                            var data = DecodeBase64("utf-8", dt.Rows[i]["WriteXmlDoc"].ToString().Trim());
                            if (data.ToString().Contains("<jyyjy></jyyjy>"))
                            {
                                data = data.Replace("<jyyjy></jyyjy>", "<jyyjy>合格</jyyjy>");
                            }
                            //if (hasM1)
                            //{
                            //    if (dt.Rows[i]["jkid"].ToString().Trim() == "18C51")
                            //    {
                            //        xmlstr_1.LoadXml(data);
                            //        if (!xmlstr_1.SelectSingleNode("/root/vehispara/jyxm").InnerText.Contains("M1"))
                            //        {
                            //            xmlstr_1.SelectSingleNode("/root/vehispara/jyxm").InnerText +=  "M1";
                            //        }
                            //        data = xmlstr_1.InnerXml;
                            //        hasM1 = false;
                            //    }
                 
                            //}
                            string sjieguo = Post(string.Format("{0}/uploaddata", urlZJ), data, "", token);
                            xmlstr_1.LoadXml(sjieguo);

                            //if (dt.Rows[i]["jkid"].ToString().Trim() == "18C55" || dt.Rows[i]["jkid"].ToString().Trim() == "18C58")
                            //{
                            //    if (dt.Rows[i]["jyxm"].ToString().Trim() == "F1")
                            //    {
                            //        MessageBox.Show("发送：" + data + "\r\n接收：" + sjieguo);
                            //    }
                            //}
                            if (!(xmlstr_1.SelectSingleNode("/root/code").InnerText == "1"))
                            {
                                //MessageBox.Show(xmlstr_1.SelectSingleNode("/root/message").InnerText);
                                MessageBox.Show("发送：" + data + "\r\n接收：" + sjieguo);
                            }

                        }
                }

            }

            #endregion

            //3.4	提交照片数据
            #region
            string smessage = "";
            string QueryXmlDoc = "";
            string stou = "<?xml version=\"1.0\" encoding=\"GBK\"?>";
            QueryXmlDoc = stou + string.Format("<root><vehispara><jylsh>{0}</jylsh></vehispara></root>", jylsh);

            Web38900.Service m_s = new Web38900.Service();
            m_s.Url = s_url_38900;
            smessage = m_s.readPictureAll("18", "18", "18", QueryXmlDoc);


            XmlDocument xmlstr_pic = new XmlDocument();
            xmlstr_pic.LoadXml(smessage);
            XmlNode node;
  
            var zp = "";
            var pssj = "";

            var zpzl = "";

            szpzl = new string[] { "A110", "A111", "0322", "0348", "0349", "0350", "0354", "ZJ14", "ZJ15" };//今后这里可以修改为读取数据

            for (int i = 0; i < szpzl.Length; i++)
            {
                if (smessage.Contains(string.Format("zp{0}", szpzl[i])))
                {
                    node = xmlstr_pic.SelectSingleNode("/root/head/zp" + szpzl[i]);
                    string str42 = node.InnerText;
                    if (str42.Length > 0)
                    {
                        zp = "data:image/jpg;base64,"+str42.Substring(19);
                        pssj = str42.Substring(0, 19);
                        zpzl = szpzl[i];
                        if (szpzl[i] == "ZJ14")
                        {
                            zpzl = "A309";
                        }
                        if (szpzl[i] == "ZJ15")
                        {
                            zpzl = "A310";
                        }
                        StringBuilder vehispara18C63 = new StringBuilder();
                        vehispara18C63.AppendFormat("<root><vehispara>");
                        vehispara18C63.AppendFormat("<jylsh>{0}</jylsh>", jylsh);
                        vehispara18C63.AppendFormat("<jyjgbh>{0}</jyjgbh>", jyjgbh);
                        vehispara18C63.AppendFormat("<jcxdh>{0}</jcxdh>", jcxdh);
                        vehispara18C63.AppendFormat("<jycs>{0}</jycs>", 4);
                        vehispara18C63.AppendFormat("<hphm>{0}</hphm>", hphm);
                        vehispara18C63.AppendFormat("<hpzl>{0}</hpzl>", hpzl);
                        vehispara18C63.AppendFormat("<clsbdh>{0}</clsbdh>", clsbdh);
                        vehispara18C63.AppendFormat("<zp>{0}</zp>", zp);
                        vehispara18C63.AppendFormat("<pssj>{0}</pssj>", pssj);
                        vehispara18C63.AppendFormat("<jyxm>{0}</jyxm>", "F1");
                        vehispara18C63.AppendFormat("<zpzl>{0}</zpzl>", zpzl);
                        vehispara18C63.AppendFormat("</vehispara></root>");

                        string surl = string.Format("{0}/uploaddata", urlZJ);
                        string sjieguo = Post(surl, vehispara18C63.ToString(), "", token);

                        XmlDocument xmlstr_1 = new XmlDocument();
                        xmlstr_1.LoadXml(sjieguo);
                        if (sjieguo.Contains("<code>"))
                        {
                            if (!(xmlstr_1.SelectSingleNode("/root/code").InnerText == "1"))
                            {
                                //MessageBox.Show(xmlstr_1.SelectSingleNode("/root/message").InnerText);
                                MessageBox.Show("发送：" + vehispara18C63.ToString() + "\r\n接收：" + sjieguo);
                            }
                        }
                        else
                        {
                            MessageBox.Show(sjieguo);

                        }
                        //LZJ20210112
                    }
                }
            }

            #endregion

            //3.5	完成检测
            #region
            sql = string.Format(@"Select * from WriteLog   where jylsh='{0}' and jkid  ='18C59' order by WriteLog_id desc ", jylsh);
            dt = mquery.GetTable(sql);
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < 1; i++)
                {
                        string stoubao = "<?xml version=\"1.0\" encoding=\"GBK\"?>";
                        var data = DecodeBase64("utf-8", dt.Rows[i]["WriteXmlDoc"].ToString().Trim());
                        data = stoubao + data;
                        string surl = string.Format("{0}/uploaddata", urlZJ);
                        string sjieguo = Post(surl, data, "", token);
                        XmlDocument xmlstr_1 = new XmlDocument();
                        xmlstr_1.LoadXml(sjieguo);
                        if (!(xmlstr_1.SelectSingleNode("/root/code").InnerText == "1"))
                        {
                            //MessageBox.Show(xmlstr_1.SelectSingleNode("/root/message").InnerText);
                            MessageBox.Show("发送：" + data + "\r\n接收：" + sjieguo);
                        }
                }
            }

            #endregion

            //3.6	提交检验总评结果
            #region
            sql = string.Format(@"Select * from WriteLog   where jylsh='{0}' and jkid  ='18C62' order by WriteLog_id desc ", jylsh);
            dt = mquery.GetTable(sql);
            if (dt.Rows.Count > 0)
            {
                string data = DecodeBase64("utf-8", dt.Rows[0]["WriteXmlDoc"].ToString().Trim());
               // data = DecodeBase64("utf-8", "<root><vehispara><jylsh>15620220228000105</jylsh><jyjl>%e5%90%88%e6%a0%bc</jyjl><pzrxm>%e5%bc%a0%e6%98%a5%e6%a2%85%e3%80%81%e9%9f%a6%e7%9f%b3%e6%b3%89</pzrxm><rgjyjgs><rgjyjg><xh>1</xh><rgjyxm>%e8%81%94%e7%bd%91%e6%9f%a5%e8%af%a2</rgjyxm><rgjgpd>1</rgjgpd><rgjysm></rgjysm><rgjybz></rgjybz></rgjyjg><rgjyjg><xh>2</xh><rgjyxm>%e8%bd%a6%e8%be%86%e5%94%af%e4%b8%80%e6%80%a7%e6%a3%80%e6%9f%a5</rgjyxm><rgjgpd>1</rgjgpd><rgjysm></rgjysm><rgjybz></rgjybz></rgjyjg><rgjyjg><xh>3</xh><rgjyxm>%e8%bd%a6%e8%be%86%e7%89%b9%e5%be%81%e5%8f%82%e6%95%b0%e6%a3%80%e6%9f%a5</rgjyxm><rgjgpd>1</rgjgpd><rgjysm></rgjysm><rgjybz></rgjybz></rgjyjg><rgjyjg><xh>4</xh><rgjyxm>%e8%bd%a6%e8%be%86%e5%a4%96%e8%a7%82%e6%a3%80%e6%9f%a5</rgjyxm><rgjgpd>1</rgjgpd><rgjysm></rgjysm><rgjybz></rgjybz></rgjyjg><rgjyjg><xh>5</xh><rgjyxm>%e5%ae%89%e5%85%a8%e8%a3%85%e7%bd%ae%e6%a3%80%e6%9f%a5</rgjyxm><rgjgpd>1</rgjgpd><rgjysm></rgjysm><rgjybz></rgjybz></rgjyjg><rgjyjg><xh>6</xh><rgjyxm>%e5%ba%95%e7%9b%98%e5%8a%a8%e6%80%81%e6%a3%80%e9%aa%8c</rgjyxm><rgjgpd>1</rgjgpd><rgjysm></rgjysm><rgjybz></rgjybz></rgjyjg><rgjyjg><xh>7</xh><rgjyxm>%e8%bd%a6%e8%be%86%e5%ba%95%e7%9b%98%e9%83%a8%e4%bb%b6%e6%a3%80%e6%9f%a5</rgjyxm><rgjgpd>1</rgjgpd><rgjysm></rgjysm><rgjybz></rgjybz></rgjyjg></rgjyjgs><yqsbjyjgs><yqsbjyjg><xh>1</xh><yqjyxm>%e4%b8%80%e8%bd%b4%e5%88%b6%e5%8a%a8%e7%8e%87(%25)%2f%e4%b8%80%e8%bd%b4%e4%b8%8d%e5%b9%b3%e8%a1%a1%e7%8e%87(%25)</yqjyxm><yqjyjg>73.6%2f8.6</yqjyjg><yqbzxz>%e2%89%a560%2f%e2%89%a424</yqbzxz><yqjgpd>1</yqjgpd><yqjybz></yqjybz></yqsbjyjg><yqsbjyjg><xh>2</xh><yqjyxm>%e4%ba%8c%e8%bd%b4%e5%88%b6%e5%8a%a8%e7%8e%87(%25)%2f%e4%ba%8c%e8%bd%b4%e4%b8%8d%e5%b9%b3%e8%a1%a1%e7%8e%87(%25)</yqjyxm><yqjyjg>67.8%2f15.0</yqjyjg><yqbzxz>%e2%89%a540%2f%e2%89%a430</yqbzxz><yqjgpd>1</yqjgpd><yqjybz></yqjybz></yqsbjyjg><yqsbjyjg><xh>3</xh><yqjyxm>%e6%95%b4%e8%bd%a6%e5%88%b6%e5%8a%a8%e7%8e%87(%25)</yqjyxm><yqjyjg>70.5</yqjyjg><yqbzxz>%e2%89%a560</yqbzxz><yqjgpd>1</yqjgpd><yqjybz></yqjybz></yqsbjyjg><yqsbjyjg><xh>4</xh><yqjyxm>%e9%a9%bb%e8%bd%a6%e5%88%b6%e5%8a%a8%e7%8e%87(%25)</yqjyxm><yqjyjg>25.5</yqjyjg><yqbzxz>%e2%89%a520</yqbzxz><yqjgpd>1</yqjgpd><yqjybz></yqjybz></yqsbjyjg><yqsbjyjg><xh>5</xh><yqjyxm>%e5%b7%a6%e5%a4%96%e7%81%af%e8%bf%9c%e5%85%89%e5%8f%91%e5%85%89%e5%bc%ba%e5%ba%a6(cd)</yqjyxm><yqjyjg>18300</yqjyjg><yqbzxz>%e2%89%a515000</yqbzxz><yqjgpd>1</yqjgpd><yqjybz></yqjybz></yqsbjyjg><yqsbjyjg><xh>6</xh><yqjyxm>%e5%8f%b3%e5%a4%96%e7%81%af%e8%bf%9c%e5%85%89%e5%8f%91%e5%85%89%e5%bc%ba%e5%ba%a6(cd)</yqjyxm><yqjyjg>22700</yqjyjg><yqbzxz>%e2%89%a515000</yqbzxz><yqjgpd>1</yqjgpd><yqjybz></yqjybz></yqsbjyjg><yqsbjyjg><xh>7</xh><yqjyxm>%e8%bd%ac%e5%90%91%e8%bd%ae%e6%a8%aa%e5%90%91%e4%be%a7%e6%bb%91%e9%87%8f(m%2fkm)</yqjyxm><yqjyjg>-0.6</yqjyjg><yqbzxz>-5%ef%bd%9e%2b5</yqbzxz><yqjgpd>1</yqjgpd><yqjybz></yqjybz></yqsbjyjg></yqsbjyjgs><jybgjy></jybgjy><jybgbz></jybgbz><jyjgbh>5200000156</jyjgbh><clsbdh>LGF179GG2DF109769</clsbdh><jycs>1</jycs></vehispara></root>");
                string surl = string.Format("{0}/uploaddata", urlZJ);
                data = data.Replace(encode("1轴制动率/不平衡率(%)"), decode("一轴制动率(%)/一轴不平衡率(%)")).Replace(encode("2轴制动率/不平衡率(%)"), decode("二轴制动率(%)/二轴不平衡率(%)")).Replace(encode("3轴制动率/不平衡率(%)"), decode("三轴制动率(%)/三轴不平衡率(%)")).Replace(encode("4轴制动率/不平衡率(%)"), decode("四轴制动率(%)/四轴不平衡率(%)")).Replace(encode("1轴加载制动率/不平衡率(%)"), decode("一轴加载制动率(%)/一轴加载不平衡率(%)")).Replace(encode("2轴加载制动率/不平衡率(%)"), decode("二轴加载制动率(%)/二轴加载不平衡率(%)")).Replace(encode("3轴加载制动率/不平衡率(%)"), decode("三轴加载制动率(%)/三轴加载不平衡率(%)"));
 
                string sjieguo = Post(surl, data, "", token);
                XmlDocument xmlstr_1 = new XmlDocument();
                xmlstr_1.LoadXml(sjieguo);
                if (!(xmlstr_1.SelectSingleNode("/root/code").InnerText == "1"))
                {
                    MessageBox.Show("发送：" + data + "\r\n接收：" + sjieguo);
                    //MessageBox.Show(xmlstr_1.SelectSingleNode("/root/message").InnerText);
                }
            }

            #endregion


            MessageBox.Show("上传完成");

        }

        private void SaveLog(string fileName, string jkid, string message)
        {
            StringBuilder path = new StringBuilder();
            StringBuilder pathRoot = new StringBuilder();
            try
            {
                pathRoot.Append(AppDomain.CurrentDomain.BaseDirectory);
                pathRoot.Append("\\log" + "\\");
                pathRoot.Append(DateTime.Now.ToString("yyyy-MM-dd") + "\\");
                pathRoot.Append(fileName);
                if (!Directory.Exists(pathRoot.ToString()))
                {
                    Directory.CreateDirectory(pathRoot.ToString());
                }
                path.Append(pathRoot.ToString() + "\\");
                path.Append(jkid);
                path.Append(@".log");
                if (File.Exists(path.ToString()))
                {
                    StreamWriter sr = File.AppendText(path.ToString());
                    //sr.WriteLine(DateTime.Now.ToString() + "【" + jkid + "】" + message);
                    sr.WriteLine(DateTime.Now.ToString()  + message);
                    sr.Close();
                }
                else
                {
                    StreamWriter sr = File.CreateText(path.ToString());
                    //sr.WriteLine(DateTime.Now.ToString() + "【" + jkid + "】" + message);
                    sr.WriteLine(DateTime.Now.ToString() + message);
                    sr.Close();
                }

            }
            catch (Exception)
            {

            }
        }

        private string GetCsysCode(string csys)
        {
            switch (csys)
            {
                case "白": return "A";
                case "灰": return "B";
                case "黄": return "C";
                case "粉": return "D";
                case "红": return "E";
                case "紫": return "F";
                case "绿": return "G";
                case "蓝": return "H";
                case "棕": return "I";
                case "黑": return "J";
                default: return "H";
            }

        }

        public string[] szpzl;
        public string s_url_38900;
       
        public static string DecodeBase64(string code_type, string code)
        {
            string decode = "";
            byte[] bytes = Convert.FromBase64String(code);
            try
            {
                decode = Encoding.GetEncoding(code_type).GetString(bytes);
            }
            catch
            {
                decode = code;
            }
            return decode;
        }

        public string encode(string str)//中文转utf8
        {
            Encoding utf8 = Encoding.UTF8;
            return HttpUtility.UrlEncode(str, utf8);
        }

        public string decode(string str)//utf8转中文
        {
            Encoding utf8 = Encoding.UTF8;
            // 首先用utf-8进行解码                    
            return HttpUtility.UrlDecode(str.ToUpper(), utf8);
        }

        public void readxml()
        {
            string path = "";
            path = System.Windows.Forms.Application.StartupPath + path + "\\DB.xml";
            string path1 = string.Format(@"{0}", path);

            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(path1);
            XmlNode xn = xmlDoc.SelectSingleNode("DB1");
            XmlNodeList xnl = xn.ChildNodes;
            foreach (XmlNode xnf in xnl)
            {
                XmlElement xe = (XmlElement)xnf;        
                sSQLConnect = string.Format("Data Source={0};Initial Catalog={1};Persist Security Info=True;User ID={2};Password={3};", xe.GetAttribute("IP1"), xe.GetAttribute("mingcheng1"), xe.GetAttribute("yonghu1"), xe.GetAttribute("mima1"));
            }
        }      

        private void but_cxjl_Click(object sender, EventArgs e)
        {
            getjilu();
        }

        public void getjilu()
        {
            listView1.Items.Clear();
            Query mquery = new Query();
            string sql = string.Format(@"SELECT * from AUTO,Detects_SJA where AUTO.AT_ID=Detects_SJA.AT_ID  and  (AUTO.AT_SYXZ !='A-非营运')");
            if (text_shphm.Text != "")
            {
                sql = sql + string.Format(@" and AUTO.AT_HPHM like '%{0}%'", text_shphm.Text);
            }
            if (text_ssyr.Text != "")
            {
                sql = sql + string.Format(@" and AUTO.AT_SYR like '%{0}%'", text_ssyr.Text);
            }
            if (che_date.Checked)
            {
                sql = sql + string.Format(@" and Detects_SJA.DET_DATE>'{0}' and Detects_SJA.DET_DATE<'{1}'", date_kaishi.Value.ToShortDateString() + " 00:00:00", date_jieshu.Value.ToShortDateString() + " 23:59:59");
            }
            sql = sql + " order by Detects_SJA.DETECT_ID desc ";
            DataTable dt = mquery.GetTable(sql);
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ListViewItem lt = new ListViewItem(dt.Rows[i]["DETECT_ID"].ToString().Trim());
                    lt.SubItems.Add(dt.Rows[i]["AT_HPHM"].ToString().Trim());
                    lt.SubItems.Add(dt.Rows[i]["AT_HPZL"].ToString().Trim());
                    lt.SubItems.Add(string.Format("{0}({1})", dt.Rows[i]["DET_JCLB"].ToString().Trim(), int.Parse(dt.Rows[i]["DET_JYCS"].ToString().Trim())));
                    lt.SubItems.Add(dt.Rows[i]["AT_CLLX"].ToString().Trim());
                    if (dt.Rows[i]["DET_LSHZJ"].ToString().Trim() == "")
                    {
                        lt.SubItems.Add("无");
                    }
                    else
                    {
                        lt.SubItems.Add(dt.Rows[i]["DET_LSHZJ"].ToString().Trim());
                    }
                    this.listView1.Items.Add(lt);                                         
                }
            }
            else
            {
                MessageBox.Show("没有记录集");
            }
        }

        public string getsqlmessage(string stable,string smessage)//获取SQL数据中对应信息
        {
            Query mquery = new Query();
            string ssqlex = "";
            ssqlex = string.Format(@"select * from {0} where table_2='{1}'", stable, smessage);
            DataTable dt = mquery.GetTable(ssqlex);
            if (dt.Rows.Count > 0)
            {

                return dt.Rows[0]["table_1"].ToString().Trim();
            }
            else
            {
                return "";
            }
 
        }
        public static string getqdxs(string qdfs, string zs, string zczw)
        {
            string sreturn = "";
            if (zs.Contains("1"))
            {
                sreturn = "";
            }
            else if (zs.Contains("2"))
            {
                if (qdfs.Contains("前"))
                {
                    sreturn = "4×2前驱";
                }
                else if (qdfs.Contains("后"))
                {
                    sreturn = "4×2后驱";
                }
                else if (qdfs.Contains("四"))
                {
                    sreturn = "4×4四驱";
                }
                else if (qdfs.Contains("无"))
                {
                    sreturn = "";
                }
            }
            else if (zs.Contains("3"))
            {
                if (qdfs.Contains("后"))
                {

                    if (zczw.Contains("2") && zczw.Contains("3"))
                    {
                        sreturn = "6×4后驱";
                    }
                    else if (zczw.Contains("2"))
                    {
                        sreturn = "6×2中驱";
                    }
                    else if (zczw.Contains("3"))
                    {
                        sreturn = "6×2后驱";
                    }
                }
                else if (qdfs.Contains("无"))
                {
                    sreturn = "";
                }
            }
            else if (zs.Contains("4"))
            {
                if (qdfs.Contains("后"))
                {
                    if (zczw.Contains("3") && zczw.Contains("4"))
                    {
                        sreturn = "8×4后驱";
                    }
                    else if (zczw.Contains("4"))
                    {
                        sreturn = "8×2后驱";
                    }
                }
                else if (qdfs.Contains("无"))
                {
                    sreturn = "";
                }
            }
            else if (zs.Contains("5"))
            {
                if (qdfs.Contains("后"))
                {
                    if (zczw.Contains("3") && zczw.Contains("4"))
                    {
                        sreturn = "10×4后驱";
                    }
                    else if (zczw.Contains("4") && zczw.Contains("5"))
                    {
                        sreturn = "10×4后驱";
                    }
                    else if (zczw.Contains("3") && zczw.Contains("4") && zczw.Contains("5"))
                    {
                        sreturn = "10×6后驱";
                    }
                }
                else if (qdfs.Contains("无"))
                {
                    sreturn = "";
                }
            }
            else if (zs.Contains("6"))
            {
                if (qdfs.Contains("后"))
                {
                    if (zczw.Contains("6"))
                    {
                        sreturn = "12×2后驱";
                    }
                    if (zczw.Contains("5") && zczw.Contains("6"))
                    {
                        sreturn = "12×4后驱";
                    }
                    if (zczw.Contains("4") && zczw.Contains("5") && zczw.Contains("6"))
                    {
                        sreturn = "12×6后驱";
                    }
                }
                else if (qdfs.Contains("无"))
                {
                    sreturn = "";
                }
            }
            else if (zs.Contains("8"))
            {
                sreturn = "16×4后驱";
            }
            return sreturn;
        }

        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            foreach (ListViewItem item in listView1.SelectedItems)
            {
                ilsh = int.Parse(item.SubItems[0].Text.ToString().Trim());
                ihphm = item.SubItems[1].Text.ToString().Trim();
                shqjclb = item.SubItems[3].Text.ToString().Trim();
                text_shphm.Text = item.SubItems[1].Text.ToString().Trim();
                zjlsh = item.SubItems[5].Text.ToString().Trim();
            }
        }

        private void listView1_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                Point p = new Point(e.X, e.Y);
                this.contextMenuStrip1.Tag = this.listView1.SelectedItems[0];
                contextMenuStrip1.Show(listView1, p);

            }
        }

        private void 评级ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (ListViewItem item in listView1.SelectedItems)
            {
                zongjianpingpan zjpp = new zongjianpingpan(int.Parse(item.SubItems[0].Text.ToString().Trim()), item.SubItems[1].Text.ToString().Trim());
                zjpp.ShowDialog();
            }
        }

        public string getsqlmessage2(string stable, string smessage)//获取SQL数据中对应信息
        {
            Query objquery = new Query();
            string ssqlex = "";
            ssqlex = string.Format(@"select * from {0} where table_1='{1}'", stable, smessage);
            DataTable dt = objquery.GetTable(ssqlex);
            if (dt.Rows.Count > 0)
            {

                return dt.Rows[0]["table_2"].ToString().Trim();
            }
            else
            {
                return smessage;
            }

        }
        public string getguocheng_time(string jylsh,string jcxm ,string bs)
        {
            Query mquery = new Query();
            string ssqlex = "";
            ssqlex = string.Format(@"select * from JianCheGuoCheng where JCGC_JCLSH='{0}' and JCGC_XM ='{1}'", jylsh, jcxm);
            DataTable dt = mquery.GetTable(ssqlex);
            if (dt.Rows.Count > 0)
            {
                string return_tiem = "";
                if(bs.Contains("18C55"))
                {
                    return_tiem = dt.Rows[0]["JCGC_KSSJ"].ToString().Trim();
                }
                if(bs.Contains("18C58"))
                {
                    return_tiem = dt.Rows[0]["JCGC_SSSJ"].ToString().Trim();
                }
                if (!string.IsNullOrWhiteSpace(return_tiem))
                {
                    return_tiem = DateTime.Parse(return_tiem).ToString("yyyy-MM-dd HH:mm:ss");
                }
                else
                {
                    return_tiem = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                }
                return return_tiem;
            }
            else
            {
                
                return  DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            }
        }
        public static string get_SfzhID(string sID)//获取名字对应的身份证号
        {
            Query mquery = new Query();
            var data = "";
            string sql = string.Format(@"select * from USERE where NAME='{0}'", sID);
            var dt = mquery.GetTable(sql);

            if (dt.Rows.Count > 0)
            {
                data = dt.Rows[0]["SFZHM"].ToString().Trim();
            }
            return data;
        }

    }
}

